AnsweredAssumed Answered

Hard fault while writing using user data to QSPI flash W25Q64JV

Question asked by THIVYA ASHOK KUMAR on Apr 29, 2020
Latest reply on May 11, 2020 by Victor Jimenez

I'm running into a weird issue that I can't get a break with. I'm running XIP on an RT1052 and I also store user data on the same flash. I got that part working by following recommendations from this forum and @Daniel Sanchez  helped me get that working. I put all my flexspi code into SRAM_ITC and disable the interrupts and cache before performing a flash write and then reenable the interrupts and cache after I'm done with the operation. Everything works fine for the first few minutes. After that, when I try writing data to the flash, there is a hard fault and I'm unable to trace back the exact instruction causing the fault.

To provide some background, the flash operations are running on a separate FreeRTOS task and I receive the data to be written over TCPIP which runs on a different task. I use LWIP for my network stack.I made sure my flash task is set at the highest priority but still I'm not sure what's causing the hard fault. Within the first few minutes, all my flash writes go through and I'm able to view the sectors being erased and written to as expected. But after about 4 minutes, when I try to write, the erase happens and when it tries to write to the flash, there is a hard fault. I tried setting breakpoints to catch where exactly it breaks but couldn't succeed. Any help with this would be appreciated.

I've attached a screenshot of my debug window. 


UPDATE: The hard fault goes away when I disable Ethernet in my code and comes back when I re-enable it. So, I'm writing to and reading from valid addresses of the flash. It is only when I introduce the Ethernet, I run into the hardfault.