Debugging LPC1343 via SWD - "Cannot stop CPU"

Comments

7 comments

  • Avatar
    Jon Elliott

    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 */
    }

    0
    Comment actions Permalink
  • Avatar
    Achim Oetringhaus

    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

    0
    Comment actions Permalink
  • Avatar
    Jon Elliott

    Try extending the reset delay by increasing the parameter to the TargetInterface.stopAndReset() function.

    0
    Comment actions Permalink
  • Avatar
    Shyan Jenq

    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);
     }
    }

     

    0
    Comment actions Permalink
  • Avatar
    Shyan Jenq

    Oh before I forget these are my interface setup parameters.

    Adaptive Clocking : Auto

    JTAG Clock Divider : 1

    Target Interface Type : JTAG

     

    0
    Comment actions Permalink
  • Avatar
    Shyan Jenq

    When I tried your method by disabling the vector interrupt I am running into something like this in the attached picture. Any idea what exactly it is? It has a message mentioning that the verifier has failed.

     

     

    0
    Comment actions Permalink
  • Avatar
    Abhijit Patil

    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); 
    }

    0
    Comment actions Permalink

Please sign in to leave a comment.