Happy Tuesday Particle People.
Ok hit a wall over here. When I plug the Electron into the asset tracker V2 I am unable to log anything to my SD Card. If I pull the electron off and put it back on the breadboard there is not problem logging the data.
I have check the resistance on the pins on the asset tracker and all looks fine.
I flashed the tinker app back to the electron and tested LED high and low while plugged into the asset tracker. Pins A5, A4, A3, A2. Are all working fine, turning leds on and off.
Plug the sd card back on to the breadboard and flash the @rickkas7 SdCardLogHandlerRK file with only the sample test file and nothing.
Pull the electron off the asset tracker, place it back on the breadboard and it logs the data to the SD card just fine. Is there a conflict somewhere between the asset tracker and the default wiring diagram used in the example?
Spark fun SD breakout board wire setup.
VCC = 3V3
CS = A2
D1 = A5
SCK = A3
DO = A4
GND = GND
I have checked and recheck all my wiring over and over. I just cant seem to figure out why it wont log when plugged into the asset tracker board.
The LIS3DH accelerometer on the AssetTracker uses primary SPI (A pins) and uses A2 as the CS line for the chip.
At minimum you’ll need to use a different CS line for your SD card as two SPI peripherals can’t use the same CS pin.
Thank you, Thank you, Thank you, Rick. I have been searching and searching. By looking at the pin diagram for the Electron the only other SPI (SS) pin I see is D5. Or is there another one that can be used? I was going to use D5 as the RES pin on an OLED screen for showing printed messages.
You can use any available GPIO pin for CS. It can be any D pin, A pin, even TX or RX if you’re not using Serial1.
Great Thank you. I will play with it and let you know if I get stuck again. I truly appreciate the help. I do try and figure it out before I harass the community. lol
Worked like a champ. I changed it to A1. Anyone else with the same problem, I hope you find the answer here.
Don’t forget to change your code.
const int SD_CHIP_SELECT = A1;
One more thing particle people. This may be obvious to others but well not me.
I switched my code to @rickkas7 2-categories.cpp, the main one was working great but I was getting additional information on the SD card that I did not want. Easy fix was to replace the code with this other one found here. This only posts the data I request.
So instead of having two lines of data per post to the SD Card, I know just have one line.
Using code: Log.info(",%s, %.1f", Time.timeStr().c_str(), flow);
Gave me two lines per SD Save Example.
0005668568 [app] INFO: ,Tue May 29 14:48:29 2018, 0.1
0005736080 [comm.protocol] INFO: rcv’d message type=13
Now using this line of code instead: LogToSD.info(",%s, %.1f", Time.timeStr().c_str(), flow);
I get one line per save to SD Card.
0000324308 [app.sd] INFO: ,Tue May 29 15:25:32 2018, 0.2
Boom, now we’re getting somewhere. It’s the little things that make you so happy when you are new to all this. Thanks again Rick.