Erasing flash memory problem in nrf52840-dk #nrf52840 #flash


Nikos Karamolegkos
 

Hello, I have made a device DTS overlay file to create my partitions in flash, so I have 3 different partitions (banks) lets say A, B, C respectively. It seems to work. However, each time I am trying to use flash_area_erase to erase the entire bankĀ  (for example delete C bank when running the A bank) I am getting error -22 (EINVAL). I tries to use the function flash_erase but I have the same errors. Also, I tried to erase some bytes (e.g 64) but the error remains. I printed the fa->fa_size and fa->fa_off variables and are correct. Any suggestions?


Nikos Karamolegkos
 

I solved the issue. The size should be multiple of 4096 (sector size). An other problem that I am facing is that when I run the lwm2m-client over openthread and the last address of the program is 0x591f3 (the first address is 0x0) if I erase a random sector (after the last address) of the memory using pyocd i.e pyocd erase -t nrf52840 --sector 0x64000, I observe that the client loses the connection with the server. Is there any bug or I am missing something? Are any credentials stored somewhere in flash?

Thank you

On 10/16/20 2:20 PM, Nikos Karamolegkos wrote:
Hello, I have made a device DTS overlay file to create my partitions in flash, so I have 3 different partitions (banks) lets say A, B, C respectively. It seems to work. However, each time I am trying to use flash_area_erase to erase the entire bankĀ  (for example delete C bank when running the A bank) I am getting error -22 (EINVAL). I tries to use the function flash_erase but I have the same errors. Also, I tried to erase some bytes (e.g 64) but the error remains. I printed the fa->fa_size and fa->fa_off variables and are correct. Any suggestions?
-- 
Nikos Karamolegkos
R & D engineer at ICS-FORTH
Telecommunications and Networks Lab (TNL)