EEPROM on STM32L0X family

Use this forum for requesting small changes in ChibiOS. Large changes should be discussed in the development forum. This forum is NOT for support.
Post Reply
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

EEPROM on STM32L0X family

Post by steved »

I've had a look to see if there's already support for the on-chip EEPROM in the 32L0x series, without success - is it a 'TODO'?

It looks as if the read side can be handled by adding the EEPROM area into the scatter file (On the 32L0x series, at least, always starts at 0x0808000).

At the lowest level the write side is pretty much the examples in the manual.

At the next level have a layer to manage block reads and writes, compatible with the drivers for external EEPROM.

If there's nothing already in place, I might have a go at this.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: EEPROM on STM32L0X family

Post by Giovanni »

Potentially everything is a TODO. Updating scatter files would be nice.

Giovanni
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: EEPROM on STM32L0X family

Post by steved »

This proved to be a bit more involved than I expected, especially since I only wanted one bit of non-volatile storage at the time! Still, my requirements have escalated to 10 time that since.

The attached project includes an EEPROM-writing library, test harness and updated scatter file for the 32L031, to run on a Nucleo32-STM32L031K6T6.

ATM I've allocated flash7 to EEPROM; maybe it should have a different name. The scatter file needs checking, since I've never done one before (and, like makefiles, it gave me a headache).

I suggest that Chibios core HAL includes just the basic EEPROM-writing primitives (byte, word, long word) and the related helper functions. They should provide a good basis for a generic interface.

I've included a generic block write routine which will be over-complex for some applications (it handles all combinations of variable alignment), but can be stripped down to suit individual applications.
Attachments
32L031K6_NUCLEO32_EEPROM.zip
(22.79 KiB) Downloaded 531 times
steved
Posts: 834
Joined: Fri Nov 09, 2012 2:22 pm
Has thanked: 12 times
Been thanked: 138 times

Re: EEPROM on STM32L0X family

Post by steved »

Fixed a bug in the block write routine (and got rid of some compiler warnings)
Attachments
32L031K6_NUCLEO32_EEPROM.zip
Updated EEPROM write project for 32L0XX
(21.98 KiB) Downloaded 509 times
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: EEPROM on STM32L0X family

Post by Giovanni »

Hi,

Moved in "bug reports" in order to not lose this in the noise of the support forum.

Giovanni
Post Reply