8 years ago.

Storing some data

Hi

I am using the stm32f091rc processor on a custom board with the mbed library. Everything is working fine - but I just need to store some data that can be retrieved eve when powered off. Is a memory card the only option or is there a way to write to some of the flash memory.

I am a newbie if this is a silly question!!!!

many thanks!

1 Answer

8 years ago.

It is possible to write to its own flash memory, the reference manual of your device can help, and/or the STM HAL files which are included in the mbed lib. However there is no easy to use library to do this for your MCU as far as I am aware. (I started it a while ago, but then found out it is different for all the STM targets, and it would have been hard to put it in one library).

Thanks! I notice that it has some backup registers with the RTC if you connect a battery.

RTC_HandleTypeDef RTCHandle

HAL_RCC_RTC_ENABLE(); PWR_CLK_ENABLE();

HAL_PWR_EnableBkUpAccess();

HAL_RTCEx_BKUPWrite(&RTCHandle,RTC_BKP0R,0x123456);

But the processor freezes on the write - anyone know why?

posted by Mark Evans 14 Apr 2016

Try putting the RTC_ENABLE after you enable the bckupaccess. Or just completely remove it, I don't know if you need that line.

By the way using <<code>> and <</code>> (on seperate lines) code gets formatted properly.

posted by Erik - 14 Apr 2016