2013-08-05 09:16 AM
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
2013-08-05 09:41 AM
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?2013-08-05 01:10 PM
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.