cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery - External interrupt requires reset button press to function

JBerl.1
Associate

Hello,

I'm trying to use an STM32F4 Discovery, specifically the LIS3DSH accelerometer onboard and I'm experiencing some behaviour relating to the external interrupt of the LIS3DSH that I'm confused by.

When downloading the code to the board using Keil uVision everything works fine. The blue and orange LEDs alternate each time the interrupt routine is run and the red and green LEDs turn on/off depending on the orientation of the board.

However, if I then unplug the board and then plug it back in, it seems as if the interrupt hasn't been activated. The end of the main function is reached as the orange LED turns on but nothing happens after that. Then, if I press the reset button on the board, the code runs as expected with the interrupt working correctly.

I can't debug the problem in Keil as whenever I try to debug the code it runs correctly; this may be because launching the debug session is seen as a reset by the board but I'm unsure of how that specifically works.

I've attached my code below and I'd really appreciate some help with where I'm going wrong. I don't understand how pressing the reset button could change how the code runs.

0 REPLIES 0