Debugging LPC1343 via SWD - "Cannot stop CPU"
Good morning,
I have CrossStudio 2.0.7, a CrossConnect Classic (Firmware 2.13) with SWD adapter and this evaluation board: http://www.olimex.com/dev/lpc-p1343.html
Connection from the SWD adapter to the board is made with my regular 20 wire ARM JTAG cable.
Target properties in CrossStudio are:
- Target Interface Type = SWD
- Adaptive Clocking: No
- JTAG Clock divider: Tried various settings from 1 to 16.
Did not manage to debug my program on the board. When I press F5, I always get "Cannot stop CPU".
My program is a simple main loop created from the "An executable for NXP LPC1300" template. STARTUP_FROM_RESET is not defined.
What can I do?
Regards,
Achim.
-
I don't think we have that board here, but I've just tried what you describe on the IAR LPC1343 KickStart board (which is made by Olimex) and it is working OK with a clock divider of 1.
The first thing I'd try is connect and see if you can view memory and modify RAM using the memory window.
If that is OK, try modifying the reset script to look something like the following to rule out reset problems:
function Reset()
{TargetInterface.stop()
TargetInterface.pokeWord(0x40048000, 2); /* Disable interrupt vector remapping */
} -
Nice, it works now. The original Reset () function was like this:
function Reset()
{
TargetInterface.stopAndReset(1);
if (TargetInterface.implementation != undefined)
{
if (TargetInterface.implementation() == "crossworks_hardware")
{
TargetInterface.pokeWord(0xE000EDFC, 0x01000000);
TargetInterface.pokeWord(0xE0001020, 0x00000000);
TargetInterface.pokeWord(0xE0001024, 0x00000000);
TargetInterface.pokeWord(0xE0001028, 0x00000805);
TargetInterface.go();
TargetInterface.delay(100);
TargetInterface.resetDebugInterface();
TargetInterface.waitForDebugState(1000);
TargetInterface.pokeWord(0xE0001028, 0x00000000);
}
}
else
TargetInterface.pokeWord(0x40048000, 2);
}
Can you figure out what was wrong?Regards,
Achim
-
Hi guys,
I am also interested in this particular topic because I ran into the same scenario with my NXP LPC1778. When I use the reset code provided by Jon, the cpu is finally running, however I would like to know what is causing it if possible and also if provided below with my original Reset function what can I modify to make it run?
function Reset()
{
if (TargetInterface.implementation == undefined ||
TargetInterface.implementation() != "crossworks_simulator")
{
/* Carry out system reset */
TargetInterface.pokeWord(0xE000EDFC, 0x00000001);
TargetInterface.pokeWord(0xE000ED0C, 0x05FA0004);
/* Run the boot loader initialization code */
TargetInterface.pokeWord(0xE000EDFC, 0x01000000);
TargetInterface.pokeWord(0xE0001020, 0x00000000);
TargetInterface.pokeWord(0xE0001024, 0x00000000);
TargetInterface.pokeWord(0xE0001028, 0x00000005);
TargetInterface.go();
TargetInterface.delay(100);
TargetInterface.resetDebugInterface();
TargetInterface.waitForDebugState(1000);
if (crcIsOK())
{
TargetInterface.go();
TargetInterface.waitForDebugState(1000);
}
TargetInterface.pokeWord(0xE0001028, 0x00000000);
}
} -
Hi Jon,
This comment is in continuation to your suggestion to Achim Oetringhaus regarding changing the reset function. I also encountered the same problem with LPC1343 using the Crossworks IDE, but when I implemented the below pasted script suggested by you it worked. However, I do realise that after doing so, my UART code does not work, especially the Receive buffer, since the UART interrupt is not generated. I have enabled the interrupts, but it seems that none of the interrupts are working, even the timer interrupt. Can you please suggest what I am doing wrong or what should be enabled to make it work?
Thanks and best regards,
Abhijit
function Reset()
{
TargetInterface.stopAndReset(1);
if (TargetInterface.implementation != undefined)
{
if (TargetInterface.implementation() == "crossworks_hardware")
{
TargetInterface.pokeWord(0xE000EDFC, 0x01000000);
TargetInterface.pokeWord(0xE0001020, 0x00000000);
TargetInterface.pokeWord(0xE0001024, 0x00000000);
TargetInterface.pokeWord(0xE0001028, 0x00000805);
TargetInterface.go();
TargetInterface.delay(100);
TargetInterface.resetDebugInterface();
TargetInterface.waitForDebugState(1000);
TargetInterface.pokeWord(0xE0001028, 0x00000000);
}
}
else
TargetInterface.pokeWord(0x40048000, 2);
}
Please sign in to leave a comment.
Comments
7 comments