LED keeps on blinking after I terminate the debug session.
I am new to embedded programming and very recently got started with programming the STM32F407G Disc-1 board with STM32CubeIDE(1.12.0).
I typical register level program for LED blinking:
Blinking the on-board LED - LD4.
int main(void)
{
uint32_t *clk_reg = (uint32_t*)0x40023830;
uint32_t *D_IO_Mode_reg= (uint32_t*)0x40020C00;
uint32_t *D_Out_data_reg= (uint32_t*) 0x40020C14;
*clk_reg= *clk_reg|0x08; //port D clock is Enabled
*D_IO_Mode_reg = *D_IO_Mode_reg & 0xFCFFFFFF;//clearing of 24 bit
*D_IO_Mode_reg = *D_IO_Mode_reg | 0x01000000;//set 24 bit
*D_Out_data_reg = *D_Out_data_reg|0X1000; //setting the 12th pin high
}
After I run the debug session and check the relevant registers, everything looks fine and the LED turns on, as it should be. However, when I terminate the debug session the LED is still ON!!.
I plugged out my device from the computer and put it back in, and still the LED is ON.
What is going on? Even the onboard reset pin doesn't reset the LED. What is wrong with my process? and how do I reset my board back to its default state??


