Store Flash Data (Eeprom?) STM32F051

An area to discuss ARM specific problems and examples

Moderator: Benj

Post Reply
sblsolutions
Posts: 1
Joined: Fri Feb 23, 2018 7:53 pm
Contact:

Store Flash Data (Eeprom?) STM32F051

Post by sblsolutions »

Hello everyone,

I'm working quite a few years with flowcode for PIC but now I want to go for the STM32 controllers.
I've made some hardware for a project and used the STM32F051c8, because this one is in Flowcode.
The datasheet says :
The non-volatile memory is divided into two arrays:
–16 to 64 Kbytes of embedded Flash memory for programs and data
–Option bytes

But how can you read and write data to this flash data range?
It's not possible with the Eeprom symbol.

Kind regards,
Rene de Jong

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by LeighM »

Hi,
We don't currently have any support for in program writing of Flash memory on STM32 devices.
We'll add it to our list for possible future additions.

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by chad »

HI, I bumped into this myself today. BUMP

chad

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by LeighM »

Hi,
I've created some macros that might work, sorry I've not had chance to test them.
Just ensure that the Address is not within your program space!
Hope it helps, let me know how it goes.
ps. the FlashByte won't work on F0, but should on F4
Attachments
ReadHalfWord.fcm
(491 Bytes) Downloaded 325 times
ReadWord.fcm
(487 Bytes) Downloaded 309 times
FlashWord.fcm
(607 Bytes) Downloaded 305 times
FlashHalfWord.fcm
(615 Bytes) Downloaded 300 times
FlashByte.fcm
(606 Bytes) Downloaded 307 times

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by chad »

Hi Leigh, Thanks! I'll try that out this weekend..

chad

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by chad »

Hi,

I did try this a long time ago. I recently took another look and couldn't get it to work. Might (probably) be my fault.
Could you take a look at this again when you have the time? A little flash byte read byte program would be really helpful.

Thanks!

cahd

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by LeighM »

Hi Chad,
Depends on how you want to use it.
Would a lookup table suffice?
The Flash has it's limitations as it needs to be block erased.
So byte write/read isn't going to be efficient.
Leigh

chad
Posts: 198
Joined: Sun Nov 04, 2018 7:13 pm
Has thanked: 27 times
Been thanked: 33 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by chad »

I haven't used a lookup table before, but sure. I think I am going to have to ultimately store like 20 variables.
Chad

User avatar
STibor
Posts: 263
Joined: Fri Dec 16, 2011 3:20 pm
Has thanked: 116 times
Been thanked: 113 times
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by STibor »

Hello!
Excellent work!
If the page block is not empty, you cannot write data.
How do I delete the data stored on the page?

User avatar
MACIANX
Posts: 11
Joined: Tue Oct 06, 2020 12:59 am
Location: USA
Has thanked: 1 time
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by MACIANX »

LeighM wrote:
Fri Nov 09, 2018 3:03 pm
Hi,
I've created some macros that might work, sorry I've not had chance to test them.
Just ensure that the Address is not within your program space!
Hope it helps, let me know how it goes.
ps. the FlashByte won't work on F0, but should on F4
Hello,
I tested these macros
Reading is not a problem and it works
I wrote and tested but it was written only once, it is not written a second time

User avatar
MACIANX
Posts: 11
Joined: Tue Oct 06, 2020 12:59 am
Location: USA
Has thanked: 1 time
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by MACIANX »

stm32-flash eeprom
Attachments
FLASH-ERASE.fcm
(553 Bytes) Downloaded 110 times

User avatar
MACIANX
Posts: 11
Joined: Tue Oct 06, 2020 12:59 am
Location: USA
Has thanked: 1 time
Contact:

Re: Store Flash Data (Eeprom?) STM32F051

Post by MACIANX »

STibor wrote:
Mon Jun 17, 2019 5:28 am
Hello!
Excellent work!
If the page block is not empty, you cannot write data.
How do I delete the data stored on the page?
Attachments
FlashHalfWord.fcm
(615 Bytes) Downloaded 99 times

Post Reply