Skip to main content
fabricepeden
Associate III
March 24, 2017
Question

problem with NVIC_SystemReset

  • March 24, 2017
  • 17 replies
  • 4318 views
Posted on March 24, 2017 at 14:47

Hi everybody,

I'm using a STM32F205VE on one of my electronic board.

I'd like to reset my microcontroller, so I use the function NVIC_SystemReset that I can find in core_cm3.h but it never works.

My board is not resetting so I don't understand what happen and why my board is not resetting.

If you've have some ideas, I'll be very happy.

Regards,

Fabrice Péden

    This topic has been closed for replies.

    17 replies

    waclawek.jan
    Super User
    March 24, 2017
    Posted on March 24, 2017 at 14:55

    How is NRST wired on your board?

    JW

    fabricepeden
    Associate III
    March 24, 2017
    Posted on March 24, 2017 at 15:13

    Thank you for your quick reply.

    My reset pin is wired on the reset pin of my programmation connector with a 10k pull-up resistor.

    I've also tried without this pull-up resistor, the result still be the same.

    Fabrice

    Tesla DeLorean
    Guru
    March 24, 2017
    Posted on March 24, 2017 at 15:29

    Make sure you have nothing driving it high (push-pull) externally.

    Review the pin state with a scope when you use NVIC_SystemReset()

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    fabricepeden
    Associate III
    March 24, 2017

    Posted on March 24, 2017 at 15:51

    Find below, the pin state when I execute NVIC_SystemReset()

    The reset pin is tied to 0V during 33µs.

    Tesla DeLorean
    Guru
    March 24, 2017
    Posted on March 24, 2017 at 16:20

    And the CPU doesn't go into the ResetHandler? You're checking/verifying this how?

    Does it continue to execute code on the other side of NVIC_SystemReset()?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    fabricepeden
    Associate III
    March 24, 2017
    Posted on March 24, 2017 at 16:38

    I have put some breakpoints in NVIC_SystemReset().

    __DSB();  => OK, firmware is going here

    SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |

    (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |

    SCB_AIRCR_SYSRESETREQ_Msk); 

     => OK, firmware is going here

    __DSB(); 

     => NOK, firmware is never going here

    while(1);

    The problem comes from the update of the register. However, the update of this register seems to be good as describes in the cortex documentation.

    Regards,

    Fabrice

    fabricepeden
    Associate III
    March 27, 2017
    Posted on March 27, 2017 at 11:52

    Hi everybody,

    I've tried to put 'NVIC_SystemReset();' somewhere else in my code, and it's always the same, my µc doesn't reset, it seems to be freeze (I have a LCD screen, I can see that this one is frozen).

    Is something can block (IT...) this function ?

    Regards,

    Fabrice

    Adalgiso
    Associate III
    March 27, 2017
    Posted on March 27, 2017 at 12:10

    in the main add this before doing anything else, I am not sure how long the delay needs to be but for me this works

    /* delay absolutely necessary when a narrow reset pulse on the NRST or/and with software or watchdog reset */

    /* Little delay */

    for(i=0;i<512;i++)

    {

    __NOP();

    }
    fabricepeden
    Associate III
    March 27, 2017
    Posted on March 27, 2017 at 14:23

    Thank you for your suggestion, but it doesn't work.

    I've tried to put (my watchdog is activated):

    while(1)

    {

       __NOP();

    }

    But it's the same, I think the core is stopped (I use also an external watchdog so I can see some LEDs and buzzer whic are activated) but my µc doesn't restart.

    Regards,

    Fabrice

    waclawek.jan
    Super User
    March 27, 2017
    Posted on March 27, 2017 at 14:36

    Write a minimal code - only a pin toggle (blinky) - and then the reset after a couple of blinks.

    JW

    Tesla DeLorean
    Guru
    March 27, 2017
    Posted on March 27, 2017 at 15:27

    Try the same code on a DISCO or NUCLEO board..

    I've only seen this fail when the NRST pin doesn't pulse low. Check the low time on the DISCO/NUCLEO test. The chip is supposed to generate a sufficiently long pulse. Make sure there isn't too much capacitance on the pin.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    fabricepeden
    Associate III
    March 27, 2017
    Posted on March 27, 2017 at 16:08

    I've download the same firmware in another electronic board...and it works. The two boards are exactly the same, but one thing that I notice, it's the revision code of the microcontroller.

    On the board, where it works, it's labelled 'X' on the µC and on the board where it doesn't work, it's labelled '2', do you think that it can be the cause of my problems ?

    Regards,

    Fabrice

    fabricepeden
    Associate III
    March 27, 2017
    Posted on March 27, 2017 at 16:45

    I've also tried with revision '1' of µc, and it works. Only with revision '2', that it doesn't work.

    Can I find modifications between revisions on ST website ?

    Regards,

    Fabrice

    waclawek.jan
    Super User
    March 27, 2017
    Posted on March 27, 2017 at 17:04

    Rev. 1 and 2 in particular differ only in details of LSE, see PCN MMS-MIC/14/8461 and the STM32F20x errata.

    I still believe it's not a problem with reset as such, but with the way how you are detecting it; i.e. that even the 'faulty' board *is* resetting, but there is something minute in the firmware+boards which makes a difference in external symptoms.

    Implement the minimal code I suggested (I forgot to say what I believe does not need extra mention, namely that the blinking should have a pattern clearly indicating reset, e.g. first blink longer) and observe with an oscilloscope/LA, or with bare eye if blinking slow enough.

    JW

    Tesla DeLorean
    Guru
    March 27, 2017
    Posted on March 27, 2017 at 17:49

    Most I have to hand look to be X and Y stepping (STM32F205ZCT6)

    http://www.st.com/content/ccc/resource/technical/document/errata_sheet/79/08/a3/cc/fa/5c/49/c5/DM00027pdf/files/DM00027pdf/jcr:content/translations/en.DM00027pdf

    Found a 2 stepping in current production, will check that now.

    Later..

    The 2 stepping chip appears to be resettable via my console, using the routine we currently use (equivalent to NVIC_SystemReset)

    SystemReset PROC
     EXPORT SystemReset
     ldr r1, =0xE000ED0C ; NVIC Application Interrupt and Controller
     ldr r0, =0x05FA0004 ; Magic
     str r0, [r1, #0] ; Reset
     b .
     bx lr
     ENDP�?�?�?�?�?�?�?�?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    waclawek.jan
    Super User
    March 27, 2017
    Posted on March 27, 2017 at 19:11

    bx lr

    ?