cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Blinky project using HAL but without CubeMX is only works in debug

Cblue_X
Associate II

Hi there!

Im currently learning STM32 MCUs using Nucleo-F446RE

I wrote two 'Blinky' firmwares:
*One using HAL and CubeMX (.ioc file)
*A second one using just HAL (NO CubeMX)

What does the FW does?: It just uses the user button on the nucleo, reads the state and "mirrors" that state on the user LED on the nucleo

In the project using CubeMX the firmware works in debug mode and in run mode (directly running on the board)

But in the project that doesnt use CubeMX the firmware works fine in debug mode but it doesnt in run mode

Both projects compile with 0 errors and 0 warnings for both, debug and release

I have read the RM and the HAL documentation but i dont have a clue where is the problem

I tried all the solutions from chatGPT and still it doesnt work

Can you help me please?

What am i doing wrong?

I let you the link to my projects if you need to check something 

Maybe the STM32CubeF4 version? (weird because both projects use the same version)

Thanks in advance!

Projects link:  https://drive.google.com/drive/folders/1xs8ck-L0GyELmdG6uNVZT-bSjg4GwUFW?hl=es-419

2 REPLIES 2
MM..1
Chief III

Just HAL is what? FYI generated project isnt only main.c , exist startup asm and c parts. How you handle this...

 

Andrew Neil
Super User

@Cblue_X wrote:

 in the project that doesnt use CubeMX the firmware works fine in debug mode but it doesnt in run mode


What, exactly, does  happen in "run" mode ?

Are you running the exact same binary, or are you rebuilding for Debug/Release ?

 

Note that you can connect to a running (or "stuck"/"crashed") system without having to reset & do a download:

https://community.st.com/t5/stm32-mcus-embedded-software/processor-stuck-if-i-run-code-without-debugger/m-p/802267/highlight/true#M63401

 

It sounds like something is wrong/missing in your startup/configuration - so carefully compare & contrast the working & non-working case...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.