cancel
Showing results for 
Search instead for 
Did you mean: 

Software vs Hardware resets

berge472
Associate II
Posted on August 05, 2013 at 18:16

I have an application that is working fine when I have a hardware reset (pulling NRST low) but when it is power cycled, or has a software reset (NVIC_SystemReset();) It gets hung up on the following functions:

#define T_CS() GPIO_ResetBits(TOUCH_CS_PORT, TOUCH_CS_PIN);
#define T_DCS() GPIO_SetBits(TOUCH_CS_PORT, TOUCH_CS_PIN);

I have traced it and it alternates which one it hangs on . What is the hardware reset doing different than software reset/power cycle? and is there a way to trigger an NRST reset in software? As I understand it, the NRST pin is just attached to an interrupt. If it matters, I am using an stm32f407VG running at 168Mhz off of a 16Mhz HSE. #stm32f4-reset
2 REPLIES 2
Posted on August 05, 2013 at 18:41

I find it a little implausible that GPIO_SetBits() or GPIO_ResetBits() would hang. What if you use GPIOx->BSRRL/BSRRH?

Are these fixed constants, or variables that have not been initialized properly or corrupted? Are the functions ASSERTing?

If variables, has the C runtime environment been initialized?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
berge472
Associate II
Posted on August 05, 2013 at 22:10

You were right. It wasn't the pin setting that was hanging. In between the pin being set and reset was an SPI function that was getting caught. The pin being toggled was the chip select, but for some reason it was getting through it occasionally but then crashing. 

I connected up an O-scope and changed it so that when It first initialized instead of just pulling it Low, it toggled Low-High-Low and now it works fine after a power cycle. I'm assuming it had something to do with the chip needing to be reset as well.