cancel
Showing results for 
Search instead for 
Did you mean: 

LED keeps on blinking after I terminate the debug session.

dip
Visitor

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??

 

1 REPLY 1
AScha.3
Chief II

>What is going on?

You flash/put a program to the cpu and then big surprise: its running ? With debug connected or not ...

 

>and how do I reset my board back to its default state??

No way to "go back" - only "go on" to next/new program.

Just flash a new program to the cpu, if this is the "original" demo program, then you have this behavior again. 

+

Maybe read/learn a little bit about these magic things, like cpu's and programs...

https://www.st.com/resource/en/user_manual/um2052-getting-started-with-stm32-mcu-discovery-kits-software-development-tools-stmicroelectronics.pdf

https://www.st.com/resource/en/user_manual/um1467-getting-started-with-software-and-firmware-environments-for-the-stm32f4discovery-kit-stmicroelectronics.pdf

 

https://wiki.st.com/stm32mcu/wiki/Category:STM32CubeIDE

 

If you feel a post has answered your question, please click "Accept as Solution".