hm_fa_da
Full Member level 5
Hello,
I've used printf function in many of my older projects without any problem, i.e stm32f103 or stm32L071 MCUs and ... (all Keil compiler).
but just got a strange problem running a simple code on STM32F407VET6.
The problem is that when I program the code on the MCU, after restart, it doesn't run the code at all.
I tried online debugger (ST-Link) to check what happens exactly, after starting the debug session, and clicking on F5 (Run) it pauses fast, then I need to click F5 3 times more and then the code runs without any problem !!!
I simplified the code to find the problem point and found it's because of just using printf command !
The problem is just using it in the code (and the complier complies it's library and adds code size) makes the problem at start up ! although the printf works correctly in the code !
here is the simplified code:
just removing the printf function solves the startup problem !
please note that the problem is just at startup (not when it reaches printf function) !
I'm confused what can be the reason ... any settings in Keil ? or ...
I tried changing complier version in Keil settings, but no result.
I tried sprintf function and didn't face that problem. seems it just happens when I use printf function in code and which makes me more confused is that the problem is only at startup of the code as described above not even reaching the printf function ... and if the codes starts anyway, it will work fine ! (printf works correctly).
I've used printf function in many of my older projects without any problem, i.e stm32f103 or stm32L071 MCUs and ... (all Keil compiler).
but just got a strange problem running a simple code on STM32F407VET6.
The problem is that when I program the code on the MCU, after restart, it doesn't run the code at all.
I tried online debugger (ST-Link) to check what happens exactly, after starting the debug session, and clicking on F5 (Run) it pauses fast, then I need to click F5 3 times more and then the code runs without any problem !!!
I simplified the code to find the problem point and found it's because of just using printf command !
The problem is just using it in the code (and the complier complies it's library and adds code size) makes the problem at start up ! although the printf works correctly in the code !
here is the simplified code:
just removing the printf function solves the startup problem !
please note that the problem is just at startup (not when it reaches printf function) !
I'm confused what can be the reason ... any settings in Keil ? or ...
I tried changing complier version in Keil settings, but no result.
I tried sprintf function and didn't face that problem. seems it just happens when I use printf function in code and which makes me more confused is that the problem is only at startup of the code as described above not even reaching the printf function ... and if the codes starts anyway, it will work fine ! (printf works correctly).