2024-04-12 05:38 AM
Hello, ST expert
CubeMX generated software framework is used for our STM32U595VJT6 based hardware design. It works well but for the low start up time. It takes almost 1 second between 3.3V is stable and the flag GPIO turns high in MX_GPIO_Init. Is there any suggstions on this problem?
BR
Yang
Solved! Go to Solution.
2024-04-12 06:53 AM
Hi,
what is "flag GPIO" ?
+
Where your clock is coming from ? (Maybe this needs so long to get stable.)
+
Try : make new stm32 project (just to test), set clock tree (use HSI), debug, your gpio pins ;
and in main just toggle a LED or a pin, to see it working.
Then generate code, compile and check : some delay there ?
Then change same , using your clock in clock tree - ... - then test again.
2024-04-12 06:53 AM
Hi,
what is "flag GPIO" ?
+
Where your clock is coming from ? (Maybe this needs so long to get stable.)
+
Try : make new stm32 project (just to test), set clock tree (use HSI), debug, your gpio pins ;
and in main just toggle a LED or a pin, to see it working.
Then generate code, compile and check : some delay there ?
Then change same , using your clock in clock tree - ... - then test again.
2024-04-19 04:57 AM - edited 2024-04-19 05:19 AM
Hello, AScha
I did it as you said. There are some updates on this problem. When the else part code is removed, the start up time is very short. But when the else part which will never reach in this case is added, the start up time is about one second, just as I said before. Is there any suggestions on this?
The code is like this:
if(1) {
xxxxxx
} else {
xxxxx
}
By the way, there is a huge global data array which is about 600KB, is it the key issue? If I change it to 1KB, the start up time is very short. Go back to 600KB, the start up time is 1 second.
BR
Yang
2024-04-19 05:24 AM
Hi,
just logical from what you ask here :
- if code (xxxx) is not used anyway, but seems to be a problem : leave it away. Is not used - right ?
+
But without joking: i dont understand your problem - wrong or not enough information about.
Set optimizer (did you ?) to -O2 ; this will remove dead code anyway, but also give some warnings, if something "suspect" in the code. Try it.
2024-04-19 06:44 AM - edited 2024-04-19 06:46 AM
Hello, AScha
I am very appreciated for your help and quick reply. Sorry for the unclear discription, it is just a example, not really if(1). It is something like this
if(condition == 1) {
xxxx
} else {
xxxx
}
And at this time the condition is 1, so the else part will not be reached. And now I found the key problem is the 600KB data array in else part(the array is a global variable). It brings the long start up time. If the size of 600KB array is changed to 1KB, the start up time is very short.
BR
Yang
2024-05-04 06:05 AM
If you have a lot of static or global data move it from initialized to unitialized data section (e.g. with prefix __no_init, depending from your compiler)!
Initializing data will be done at startup (before entry to main function) on startup clock frequency (16MHz?). Therefore this can take a long time.
If you need to initialize huge data blocks, do it manually with memset() after setting the MCU clock to max speed...