Been tearing my hair out recently trying to troubleshoot and determine the root cause of frequent SD card crashes in our embedded systems. This is related to a discussion between myself, @SCM and @mbyamukama that was started a while back (see link below), but I wanted to move the discussion to its own thread.
Some relevant info:
- We are using SDFat (SPI running at 10 MHz) running on Particle OS
- We are also running a LCD display off of this SPI bus (write-only)
- We are using authentic SanDisk 8 GB Standard and 16 GB Ultra microSD cards
- We are powering the SD card off of the 3v3 power supply that is built into the Electron
- I have implemented a cooldown period between calls to Particle.publish() and SDFat sync operations (writing info to the SD card) to try and avoid transmission-induced voltage supply transients causing problems with SD card writes
- We have observed that SD card crashes are much more prevalent when there are local network connectivity issues (which presumably would cause the Electron to increase it’s transmission power, thus increasing potential for EMI and voltage supply dips/transients)
- The SDFat error codes and error data associated with SD card crash events seem to be widely variable
- (edit) I’m running
- (edit) I’m using SDFat V 1.0.5 downloaded directly from GitHub (not the SDFat from Particle libraries)
- (edit) I’m using the primary SPI peripheral (the one that uses pins A3, A4, A5)
The current working theory:
Electron transmission bursts are causing voltage supply dips/transients and/or EMI that are in turn causing the SD card to crash
Currently planned PCB re-design solutions to this problem:
- Move the location of the SD card holder such that it will be located away from the side of the Electron that the cellular antenna connects to
- Add a dedicated 3v3 regulator (with EN pin) to power the SD card (can be power cycled programmatically by the Electron in the event of an SD crash)
- Anyone else having issues with SD cards crashing in embedded applications with the Electron?
- What about in non-Electron embedded applications?
- Anyone else have any theories on what the root cause of these SD crashes might be?
- Does anyone know of any way to force an Electron to transmit cellular bursts at full intensity so that I can test the current working theory?