Page 1 of 3

STM32F QUESTIONS

Posted: Thu Jan 09, 2025 9:54 pm
by max.tisc
Hi everyone
Up until now I have been playing with Arduino and atmega which has an internal EEPROM memory for saving data and which was managed by the EEPROM component, now I am getting closer to STM32F446 and in the datasheet I see that there is no EEPROM memory to use but a 128Kb SRAM + another 4Kb also used by the internal RTC, the questions are:
what is the right memory to use for saving data?
Is there a component on FC9 that manages it? Is it better to use an external EEPROM type 24C16?
STM32 already has an internal RTC is there a component that manages it?
Thanks to everyone

Re: STM32F QUESTIONS

Posted: Fri Jan 10, 2025 12:38 pm
by LeighM
The Real Time Clock (Internal) component supports STM32F4 series devices

Re: STM32F QUESTIONS

Posted: Sat Jan 11, 2025 12:16 am
by max.tisc
hi LeighM
thanks for the suggestion
I tried the internal component but it behaves strangely, I made a small preogram to test it and if at the beginning of the program I initialize the component the led does not flash and the program remains blocked even if in simulation it works, if it is not initialized the led flashes and in the uart I always read 00:00:00. so the program runs but does not read the time
Can you also give me an answer regarding saving in EEPROM?
thanks

Re: STM32F QUESTIONS

Posted: Sat Jan 11, 2025 10:21 am
by LeighM
Have you got an external 32.768 KHz crystal?
Or try setting clock source to internal.

As for EEPROM, there's no doubt lots of views on this,
I don't think there is any EEPROM emulation for the STM32F devices,
but I've successfully used 24C16 type devices on numerous projects.

Re: STM32F QUESTIONS

Posted: Sat Jan 11, 2025 3:49 pm
by max.tisc
the card I'm testing is a blackpill (stm34f411 waiting for the stm32f446 to arrive) that mounts the 32khz quartz and as you can see from the screenshot I had already selected 32khz external clock, it seems that the problem arises from the initialization block of the RTC which if inserted blocks the normal continuation of the program

Re: STM32F QUESTIONS

Posted: Sat Jan 11, 2025 11:03 pm
by max.tisc
could it be that the problem is in the configurations?
the board has a main resonator at 25Mhz and for RTC at 32.768Khz

Re: STM32F QUESTIONS

Posted: Sun Jan 12, 2025 11:44 am
by LeighM
Could you try adding this C code into a C icon just before the call to RTC::Initialise()

Code: Select all

__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);
If using internal clock, this should be the last line instead ...

Code: Select all

__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSI);

Re: STM32F QUESTIONS

Posted: Sun Jan 12, 2025 4:02 pm
by max.tisc
thanks to LeighM
configured with LSI it works, if configured with LSE it continues to block the program

Re: STM32F QUESTIONS

Posted: Sun Jan 12, 2025 5:28 pm
by LeighM
Try this (I haven't got a board with crystal to test) ...

Code: Select all

__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_LSE_CONFIG(RCC_LSE_ON);
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_LSE);

Re: STM32F QUESTIONS

Posted: Sun Jan 12, 2025 5:51 pm
by max.tisc
no it's still blocked