I am trying to implement FW update through ethernet on SAME54 so briefly I am booting from BANKA and will write new FW to BANKB and then switch banks and reboot. There is an application note for SAM4S from Atmel (no FreeRTOS).
I am building my project based on one of Atmel-start sample projects (LwIPsocketapiexample) with FreeRTOS and LWIP. This project is working fine. I have added the flash driver to that project in Atmel -start and tried to test writing one page (512 B) into starting address of BANKB (0x80000).
The sample project has three existing tasks two for LWIP and one of them just blinking a LED. I used the example function (FLASH_0_example) in the LED blinking task before the infinite loop.
Surprisingly, it is crashing after writing the data into the flash. I am using SAME54 explain pro board and can see the data is written in the flash correctly but after finishing the flash_write function it is throwing hard_fault exception. I tried to disable interrupts also completely suspend other tasks during flash access but still no luck.
Any thought that what can cause the problem or suggestion that how I can debug this.
Thanks a lot,