cancel
Showing results for 
Search instead for 
Did you mean: 

I'm trying to use flash memory on a STM32L452RE to store some user data. i can get the X-CUBE-EEPROM_V2.0.0 to work with a 4+ device, but not the L452RE

JCobu.1
Associate II

Specifically, as soon as it tries to read flash (this first line from the EE_Init ==> addressvalue = (*(__IO EE_ELEMENT_TYPE*)(pageaddress + varidx)); it hard faults on the next instruction. i suspect it has something to do with dual mode vs single mode flash banks and the possible width difference, but i've been playing with it for a day and can't find the magic switch.

i have taken the Project application from included files and made all the changes using the IAR tools (CPU, s file, icf file etc. along with preprocessor vars.) i'm working with two Nucleo boards. my target one is MB1319B.

thanks,

1 REPLY 1
DClar.1
Associate

Hi -

Did you manage to fix this issue? I'm getting a similar error at the same line in EE_Init(), I'm using a NUCLEO-452RE dev board, which isn't a 4+ device so the issue may not be with flash banks. I initially had the hard fault you're seeing until I changed START_PAGE_ADDRESS to match our required memory map (0x0807e000). As we don't require much persistent storage I also reduced the number of guard pages to zero. This gave us the 4 pages we needed and in initial testing everything was fine, However, after I used EE_Format(), and ran my tests again, I started getting an error at the same line in EE_Init(), but this time as a NMI issue. I tried the same code on another dev board - without call to EE_Format() - and the tests worked again! Not sure why formatting flash has caued my problem, but I think your issue may be to do with the selection of page count, size and location.