CPU stuck in reset after programming

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • CPU stuck in reset after programming

    Hi,


    I am using J-link Base model to program a board based on Atmel ATSAM4E8C Cortex device. In roughly 1/3 cases board is stuck in reset after programming and it seems the only way to make it run is to power cycle the PCB. I use J-link commander in batch mode to perform the flashing process and it does not seem to report any problems when this reset issue happens. Below is the source of the commander script I am using.

    Source Code

    1. device ATSAM4E8C
    2. r
    3. h
    4. loadfile "C:\temp\zezb1_jig\MainAll_serialised.hex"
    5. r
    6. go
    7. exit


    I tried adding:

    Source Code

    1. exec SetResetType = 2


    after the device command but that does not seem to help. Any ideas as to how I can overcome this problem? The CPU's reset line is connected to the SWD interface, but for some reason even the hardware watchdog is unable to reset the CPU once it's stuck, only a power cycle seems to work.



    Edit: Something I have noticed is that once the CPU was programmed once it does not get stuck in reset when it gets programmed again, i.e. flash has the previous version of the program. The problem seems to appear only on fresh blank units or on units which have been fully erased prior to programming again.

    The post was edited 1 time, last by GeekCharge ().

  • I have done a little probing on the reset line and I am not quite sure what is going on with my j-link. I have run this commander script to stimulate the reset line.

    Source Code

    1. device ATSAM4E8C
    2. r
    3. Sleep 10
    4. RSetType 2
    5. Sleep 10
    6. r0
    7. Sleep 10
    8. r1
    9. exit


    std_reset.png is a screenshot from my logic analyzer, you can clearly see the approx. 10ms delay caused by the r0/r1 commands.
    But if we zoom in we can see quite a bit of mess caused by the earlier reset commands on the reset_mess.png attachment.

    Note: it seems the mess is not related to the first reset commands, they simply do not cause any changes on the reset pin.
    Images
    • std_reset.png

      12.34 kB, 964×277, viewed 630 times
    • reset_mess.png

      12.12 kB, 960×259, viewed 637 times

    The post was edited 3 times, last by GeekCharge ().

  • Hi,

    In roughly 1/3 cases board is stuck in reset after programming

    Do you always program the same board and it fails in 1/3 of the cases? (e.g. for debugging)
    Or do you program a different board every time and every third one failes?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Does anyone have any suggestions, please? I can see other people had similar issues with other CPUs so there must be some bug somewhere.

    Never heard of such a problem before.
    Also, if they do not see exactly the same problem on exactly the same device, it means nothing. Especially reset operation is very different for each device series out there.

    Do you see the same problem on an eval board?

    What do you mean with "stuck"?
    Where is the CPU stuck?
    What instruction/address. etc.?


    Best regards
    Alex
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • This design is not based on an eval board.

    Let me clarify what is happening step by step.
    1. Board is built on an SMT line, checked and verified for manufacturing problems etc..
    2. The SWD interface of the micro is then connected to the J-link probe. I execute the J-link commander script, as mentioned earlier, to program the board.

    In one out of three boards the board does not come out of reset, I have no idea what address or instruction is executed, as far as I can tell nothing is happening.
    When I power up a blank board all of the LED indicators are on as the micro is not programmed, as soon as the device is programmed and reset the LEDs turn off, the application starts and takes control over the LEDs etc., I can see stuff coming out of the debug serial port etc. When a board gets stuck, the LEDs are still on, nothing comes out of the debug port and the only way to "reset" it is to turn the power off and back on. This only seems to happen when a board is blank prior to programming, if I reprogram the same board it never gets stuck, it always comes out of reset and starts operating immediately. J-link commander does not report any problems, it seems to be executing all commands from the script and simply exits.

  • Hi,

    For SAM4E devices, a GPNVM bit must be set to boot from flash. Default is boot from ROM. In general, the J-Link software sets the GPNVM bit to boot from Flasher when programming the internal flash. However, according to your description, it seems like the GPNVM bit is set correctly to boot from flash (as the device boots correctly from flash after power-on-reset) but it seems like the boot selection is not taken into account after a power on reset but not after a ordinary core reset.

    The SAM$E reference manual does not provide any detailed information about when the GPNVM bit is evaluated. However, can you please check the GPNVM bit manually using the sequence described in the SAM4E reference manual?

    a) Check the GPNVM bit before programming
    b) Check the GPNVM bit after programming

    Another question:
    If the behavior popped up on lets say device A, is it reproducible on this device after performing a mass erase?


    Best regards
    Erik
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Quick follow up: Please use the latest version V6.12a for your tests.


    Best regards
    Erik
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.