CAN frame corruption following FATFS write to FLASH
Posted: Mon Dec 09, 2019 12:55 pm
I have a CAN based application which allows configuration parameters to be set from a web page.
I use a small FATFS partition to hold configuration parameters. The end user may configure using a web application.
The web page triggers a save (POST) and the new parameters are written to flash using fopen(), fprintf(). Configuration values are saved from a std::thread woken using a std::mutex.
On clicking the web application 'Save' button I have noticed corruptions within CAN frames received. The corruption always seems to be in data[7] and has the value 0x88. I print the received frames immediately following can_receive(). I only use/decode the frame if can_receive() returns 0.
I am wondering power (& will probe) but it does seem strange that the corruption is always data[7] and always 0x88.
I monitor stack sizes and have 500 bytes left using the high water mark.
I am using ESP-IDF v4.0-dev-562-g2b301f53e
I undestand that there are various limitations in writting to FLASH. My configuration 'saver' is not IRAM, I assume that the FATFS routines are.
Any thoughts welcome!
I use a small FATFS partition to hold configuration parameters. The end user may configure using a web application.
The web page triggers a save (POST) and the new parameters are written to flash using fopen(), fprintf(). Configuration values are saved from a std::thread woken using a std::mutex.
On clicking the web application 'Save' button I have noticed corruptions within CAN frames received. The corruption always seems to be in data[7] and has the value 0x88. I print the received frames immediately following can_receive(). I only use/decode the frame if can_receive() returns 0.
I am wondering power (& will probe) but it does seem strange that the corruption is always data[7] and always 0x88.
I monitor stack sizes and have 500 bytes left using the high water mark.
I am using ESP-IDF v4.0-dev-562-g2b301f53e
I undestand that there are various limitations in writting to FLASH. My configuration 'saver' is not IRAM, I assume that the FATFS routines are.
Any thoughts welcome!