In testing my application I have noticed a problem with the SPI bus use when WiFi is on but the WAP for the stored credentials is not available (switched off or out of range). I can repeat the issue which manifests as the application thread blocking if the SPI bus is used approximately 70 seconds after a restart.
I have Log traced the issue to be in a function which reads an image file (.bmp) from SD card and writes to a TFT screen. This action involves having a file open and repeated reads to a buffer and then writes to the TFT screen pixel by pixel. There is a lot of activity on the SPI bus. There is no memory issue. The application hang is ‘caught’ by the application watchdog, the trace and memory captured and the device restarted.
The application will hang approximately 70 seconds after restarting - SYSTEM_THREAD(ENABLED) and SYSTEM_MODE(SEMI_AUTOMATIC). The photon LED will be flashing green throughout, the system thread is not impacted. The device has valid credentials but the WAP for those credentials is turned off when restarted - WICED returns 1024 error. All calls to blocking Particle cloud functions are surrounded by tests for Particle.connected().
The cause of the hang appears to point to an SPI bus issue - can anyone help with any experience and whether this can be caught and corrected or indeed this theory can be confirmed? Reducing the SPI speed appears to solve the problem - need to do more testing though to be sure.