uSD get corrupted files while reading with a teensy3.2

Status
Not open for further replies.

daga

New member
Hi all,
We created some devices (50) using teensy 3.2, an SD card reader and a LORA radio module RFM95W.
Basically the device will, among other things, continuously read files from the SD card while talking over the radio. Both the SD card and the radio are connected using SPI.
The thing is that after some weeks we got back the devices and 4 of them had corrupted SD cards (files unable to read). We were using only reading and listing operations, so my first question is:
* Is it possible to corrupt an SD card while using read only operations?
We had some trouble with the radio over SPI (using radiohead library) conflicting with other operations (SD card reading for instance).
* Can a busy SPI channel cause corruption on the SD card's files while reading?
I am just looking for some directions to attack the problem.

Thanks

Hardware used: Teensy 3.2, usdCard reader, Adafruit RFM95W LoRa Radio
Libraries used: SD, radiohead
Wiring: both usdcard (CS pin 28) and rfm95 (CS pin 10) are attached to the teensy 3.2 spi
Sorry for not posting code, I can't share it because of company policy.
 
Hi,

if you use an SD card and some other devices on the same SPI bus, then the first thing to do after power-on is to bring the SD card into SPI mode. By default SD cards are in SD mode after power-on, where they could/would interpret SPI commands to other devices as SD commands addressed to themselves, even if their !CS pin stays high.

Kind regards,
Sebastian
 
Thank you Sebastian,
I will check the initialization order to verify that it is correct. What we found is that some data files of the SD are corrupted. They are impossible to read or copy to verify its content, apparently they cannot be accessed even exist and taking a normal file size.

Kind regards.
 
If you ask me, putting an SD card and other devices on the same SPI bus is a fragile design, as any "accidental" power cycle of the SD card returns the card into SD mode, possibly unnoticed by the host, where it would interpret SPI commands addressed to other devices on the bus as SD commands.

Worse, the latest "Physical Layer Simplified Specification Version 7.10" even states: "The card may respond to the commands and functions [defined in SD mode after Version 2.00] even if the card is in SPI mode but hosts should not use them in SPI mode." Taken by the letter this implies that SD cards can not share the SPI bus with other devices anymore.

Unfortunately that does not mean that this is for sure the reason of the corruptions you are seeing ...

Kind regards,
Sebastian
 
Thanks for the answer,
Is any way on teensy 3.2 to corrupt a micro sdcard on a separated SPI bus by doing only read operations? we found that 35 of 47 devices that we made had the sdcard with a file or files unable to be accessed (corrupted).

kind regards.
 
Status
Not open for further replies.
Back
Top