I am having trouble running the debugger on a STM32F205ZG using µVision4 and the ULINK2. I keep getting the error message "Could not stop Cortex-M device! Please check the JTAG cable." I am using the SW port. Any help with this would be greatly appreciated.
I know this post is quite old now but I have found a resolution for my problem. It turns out the ulink2 was faulty, when I managed to get hold of a different ulink2 and tried that I managed to get the debug working. Thanks to everyone for their help.
Actually I've seen this behaviour a few times on NXP devices using uLink, and have been able to erase and re-program them with LPCXpresso, after which the uLink works fine.
The problem was that the code loaded in flash was faulty and was placing the CPU into a busy loop branching back to the same address, this prevented the debugger accessing the bus.
the uLink worked if I put the device into ISP mode as it never got to the user code.
it seems that uLink takes too long to halt the device after reset, the spec tells you this somewhere, so by the time uLink tries to halt the CPU it is too late as it cannot access the bus and locks up.
so it may be that the uLink was not faulty, but the timing was simply marginal.
a simple fix is to code a delay in your startup code long enough to guarantee that uLink can stop the CPU before it crashes.
regards
Phil.
Thanks Phil, I will remember this if the problem repeats itself.
I remembered a bit more now, I was generating an exception which was not handled causing the default handler to be called, this is simply a branch back to itself which seems to hang the bus. I modified the default handler to have a small loop with nop instructions instead of a branch back to itself so that the debugger can gain access.
since then I haven't needed to use the LPCXpresso .
Good post you guys! Thanks for the info. I'm sure I'll need it in the future.
Bradford