STM32F QUESTIONS

For general Flowcode discussion that does not belong in the other sections.
LeighM
Valued Contributor
Posts: 447
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32F QUESTIONS

Post by LeighM »

Btw. You might need to do a board power cycle for changes in this domain to take effect

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Re: STM32F QUESTIONS

Post by max.tisc »

great LeighM
turned it off and on again and the LED started flashing and I get the date and time, I tried to change the date and time and everything works correctly
thanks
Attachments
Screenshot 2025-01-12 213101.png
Screenshot 2025-01-12 213101.png (225.96 KiB) Viewed 3754 times

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Flowcode v9 Re: STM32F QUESTIONS

Post by max.tisc »

Hi LeighM
unfortunately I found another problem with the internal RTC whether it is configured as LSE or as LSI, I noticed that if the card is turned off for a while (a few hours) the RTC does not start and blocks the program, I do the initialization of the RTC first and only after several turns on and off it restarts, but if I turn it off for a few seconds when I turn it back on it resumes normally and the time has gone forward despite there being no external battery or large capacitors on the power line (probably the few uF of filter are enough to keep it active for a few seconds)
thanks
Attachments
Screenshot 2025-01-27 181406.png
Screenshot 2025-01-27 181406.png (167.45 KiB) Viewed 3313 times

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Flowcode v9 Re: STM32F QUESTIONS

Post by max.tisc »

other info that maybe can help you
1) I wanted to write a few minutes and not hours
2) I lowered the Hclk to 25 Mhz (before it was 80Mhz) and the failure to restart has become more sporadic
3) I eliminated LSE as the main clock and set HSI RC and working at 16Mhz the problem occurs very very rarely
4) just now I realized that probably when the program seems blocked in reality it is greatly slowed down in the video that I managed to load you can see the LED flashing very fast while when it seems blocked the LED flashes very slowly
thanks
Attachments
OK.zip
(818.68 KiB) Downloaded 15 times
NOT OK.mp4.zip
(2.4 MiB) Downloaded 16 times

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32F QUESTIONS

Post by LeighM »

It could be that startup times for the LSE oscillator are causing issues.
For the RTC to work properly you need a constant battery supply to VB pin.
The Battery backup domain section of the Reference manual RM0383 provides some useful information.
This can be downloaded from the st.com website.

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Re: STM32F QUESTIONS

Post by max.tisc »

ok LeighM thanks
now I added a 3V button battery between the Vbat and negative pins and this happens:
setting the main oscillator on HSE and the RTC oscillator on LSE (crystal exsternal screenshoot 2) 10 times out of 10 the program does not start
if I leave the main oscillator on HSE and the RTC oscillator on LSI ( LSI RC screenshoot 1) , the program always restarts even after several minutes but minutes and seconds in the time in which the main power was disconnected the time did not go forward, but restarts from the moment it was disconnected
Attachments
scr2.png
scr2.png (156.77 KiB) Viewed 3261 times
scr1.png
scr1.png (175.3 KiB) Viewed 3261 times

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32F QUESTIONS

Post by LeighM »

Could you put the RTC initialisation code on a button or serial command?
That is, just do it once to setup the RTC, not on every reset or display.

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Re: STM32F QUESTIONS

Post by max.tisc »

ok I'll try and let you know (I hope I understood what you're asking)

max.tisc
Posts: 113
Joined: Thu Dec 10, 2020 5:40 pm
Been thanked: 10 times

Flowcode v9 Re: STM32F QUESTIONS

Post by max.tisc »

Hi, I've done a lot of tests and this configuration has never given me any problems with the program crashing.
Attachments
2025-02-03.png
2025-02-03.png (171.32 KiB) Viewed 3022 times

LeighM
Valued Contributor
Posts: 447
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 81 times
Been thanked: 243 times

Re: STM32F QUESTIONS

Post by LeighM »

I've put the code into the CAL file (STARM_CAL_RTC.c)
this goes into directory...
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\STARM\
This will avoid the need for the extra C icon code.
Note that if you swap between LSI and LSE you need to cycle all power
Attachments
STARM_CAL_RTC.c
(8.16 KiB) Downloaded 7 times

Post Reply