FLash As EEPROM

Dear all,

Since some time I'm working a project called the 'micromouse', where the goal is (simply said) building a small robot that should solve a maze and find the shortest path.

I'm using the ItsyBitsy M4, only it doesn't have EEPROM. Most of the people solve this by using Flash As EEPROM. I found a library in order to do that, however I'm have difficulties using it. This is the link to the library: GitHub - cmaglie/FlashStorage: A convenient way to store data into Flash memory on the ATSAMD21 and ATSAMD51 processor family. Right now I've included the FlashAsEEPROM in my project, but I come across some strange errors.

Compiling 'micromouse' for 'Adafruit ItsyBitsy M4 (SAMD51)'
FlashStorage.cpp: In member function void FlashClass::write(const volatile void*, const void*, uint32_t)
 
FlashStorage.cpp: 56:22: error: 'volatile struct NVMCTRL_CTRLB_Type::<anonymous>' has no member named 'MANW
   NVMCTRL->CTRLB.bit.MANW = 1
 
FlashStorage.cpp: 61:26: error: 'NVMCTRL_CTRLA_CMDEX_KEY' was not declared in this scope
Error compiling libraries
   NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC
Build failed for project 'micromouse'
 
FlashStorage.cpp: 61:52: error: 'NVMCTRL_CTRLA_CMD_PBC' was not declared in this scope
   NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_PBC
 
FlashStorage.cpp: 62:33: error: 'volatile struct NVMCTRL_INTFLAG_Type::<anonymous>' has no member named 'READY
   while (NVMCTRL->INTFLAG.bit.READY == 0) { }
 
FlashStorage.cpp: 74:52: error: 'NVMCTRL_CTRLA_CMD_WP' was not declared in this scope
   NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_WP
 
FlashStorage.cpp: 75:33: error: 'volatile struct NVMCTRL_INTFLAG_Type::<anonymous>' has no member named 'READY
   while (NVMCTRL->INTFLAG.bit.READY == 0) { }
FlashStorage.cpp: In member function void FlashClass::erase(const volatile void*)
 
FlashStorage.cpp: 93:24: error: 'NVMCTRL_CTRLA_CMDEX_KEY' was not declared in this scope
   NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_ER
 
FlashStorage.cpp: 93:50: error: 'NVMCTRL_CTRLA_CMD_ER' was not declared in this scope
   NVMCTRL->CTRLA.reg = NVMCTRL_CTRLA_CMDEX_KEY | NVMCTRL_CTRLA_CMD_ER
 
FlashStorage.cpp: 94:32: error: 'volatile struct NVMCTRL_INTFLAG_Type::<anonymous>' has no member named 'READY
   while (!NVMCTRL->INTFLAG.bit.READY) { }

Does anyone know what could possibly be going wrong? If it's necessary I will post my main code where I include the library as well, however I don't see the point of it since the problem (as I see it) is most likely in the library itself.

that library is for SAMD21

Juraj:
that library is for SAMD21

Well that makes sense....

Is there any way to solve this (easy)?

Unless someone has already ported the library to the SAMD51 then it will not be easy. Doing that kind of port is going to take many hours reading the datasheets and testing, even for processors with such "close" names.

I've been down that path, don't go there. Use an SD card. Its a bit of work to wire it up. But the code to run them is right here and easy to use. As long as you don't try to rename anything. Most displays have SD cards built in, you have a display on your mouse?

-jim lee