[SdCardLogHandlerRK] [Electron] No logs in the SD card


#1

Hello all,

I’m using the SdCardLogHandlerRK library but so far without success to have it logged data in the SD card.
This is what I have tried so far

  1. Adding the library in my code and the logging functions as per the example. The log is properly displayed in the serial console but nothing in the SD card. I got error mkdir failure.
  2. I changed SPI_FULL to SPI_HALF_SPEED, no success.
  3. I have created the folder logs in the SD card and reinserted it. When I open the folder logs, I see many folders and files in garbled text. The files and folder can’t be opened. I formatted the SD card, did again the same, but same result garbled text and empty files.
  4. I thought there was an issue with my code, so just used the example as it is (https://github.com/rickkas7/SdCardLogHandlerRK/blob/master/examples/1-simple/SdCardLogExample.cpp) , but the same result.
    I checked a million of times the connection and I don’t think there is an issue with it. I just connected as in the example. The only difference is that I’m using an Electron instead of a Photon.

Module -> Electron
3v3 -> 3v3
CS -> A2
MOSI -> A5
CLK -> A3
MISO -> A4
GND -> GND

Now I’m clueless therefore turning to the community.

Thanks all in advance!


#2

Have you tried to write to SD directly (e.g. by means of a suitable example that comes with the SDFat library) to check whether the hardware setup works reliably?


#3

Hello ScuffR,
yes I just did with the TrymeFirst example from SDFat library and the content of the SD card is still empty. I also tried to change SD card but I have the same result.
This what I get as a result .

Serial monitor opened successfully:

Writing to test.txt…done.
error: opening test.txt for read failed
SD errorCode: 0X13,0X0

It looks it could open the file for writing and wrote properly but it fails at reading.

Here is how I connected it.
3v3 -> 3v3
CS -> A2
MOSI -> A5
CLK -> A3
MISO -> A4
GND -> GND
I will update the ticket with that info.
Thanks!


#4

What SD card holder are you using.
Some come with level shifters and on those the 3v3 pin is only an output.

You should use a card holder without level shifting since SD cards work on 3.3V and the Electron GPIOs are also 3.3V - level shifting would just introduce problems.


#5

Thanks again ScruffR!
I just got it in a shop that sells some Chinese electronics parts. It was new and I bought some other parts there previously that worked so I though it would be good as long as it is 3v3 compliant. Their stuff are cheap but you don’t have any info on it such as whether there is a level shifting or even diagrams for some of their products. I guess I will try to look for another holder and try with that.

Thanks!


#6

btw the one that author of the library used has level shifting too but yeah maybe I should just try with a new one or the same one he used.


#7

Have you got a hi-res photo of the board (both sides)?


#8

Hello ScruffR,
yes please find attached the pictures. Hope it is hi-res enough :slight_smile:


#9

@damonzon can you now show a picture of how you have connected?


#10

Hello peekay123,

I don’t currently have a picture of how I did connect but I have updated the ticket description with the pins mapping between the electron and the module. I’m using a breadboard and just did it as in the example in the library (there is a picture attached : https://github.com/rickkas7/SdCardLogHandlerRK). I’m not using any resistors and capacitors anywhere if this is what you are referring to.

Thanks!