Add SdCard To Sodaq one

Hi,

I want to add a SdCard to a sodaqone.
I see this in a post :

The SPI bus is available on JP1 on the following pins:

MOSI = pin 4 (schema label AIN18)
MISO = pin 6 (schema label AIN16)
SCK = pin 3 (schema label AIN19)
SS/CS = pin 5 (schema label AIN17)

So the CS is on digital 9, is that correct because for the moment I can’t make it work.

Thanks

Can you provide the details of what SdCard device and library you are using?
Also what revision Sodaq One are you using?

I have bought this one : http://www.ebay.fr/itm/271586626772?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT and this micro sd : http://www.ebay.fr/itm/ultra-small-micro-SD-module-lecteur-carte-micro-sd-Arduino-Pi-STM32-mini-SD-/272081428598?hash=item3f59512076

They both use VCC 3V3, CS, MOSI, CLK, MISO and GND Interface.
So I plug them respectively on sodaq base to : 3.3V, D9, D10, D11,D8 and GND pin.

I have tried sd lib from arduino IDE and also this one : sdfat from https://github.com/greiman/SdFat

The revision of the board is 4.

Thanks for your help

What capacity and format is the SD card.

I believe there are issues with the format of the higher capacity cards due to licensing issues.

The CS pin is simply just an IO pin which signals the device when the master wants to communicate with it (it is set to HIGH to active the the slave SD card). You could try using another IO pin.

As you are using a revision 4 board, make sure that you do not have the SODAQ One BETA board selected in the IDE.

I do not have an external SPI SD card reader, however, I will try another SPI device and confirm the pins for you.

I was using 16 Go card, I have tried now a 2 Go with same bad result.

Is there any problem to use D11(use as CLK) because it’s already used to enable power on 2/3 6/7 8/9 ?

I’m not sure what you mean here? Is this a feature of the ONEbase board?

Yes, See here on http://support.sodaq.com/sodaq-one/

Base Orientation and antenna connection

If you want to use the pins: 2/3, 6/7 and 8/9 you first have to set pin D11 high.

Yes !!!

It’s the problem, if I plug directly without onebase, it’s working

If you have an idea to get it working with the base, I will be happy :wink:

I’m sorry but I don’t have a ONEbase (or the schematic).

On the ONEbase, are you using the 3.3V pin directly above the other SPI pins?

If so, that appears to be a switched source (it is labelled “3.3V SW”), my guess is that is also controlled by D11.

In answer to a previous question, it is probably a bad idea to use D11 for the CS pin.

I don’t use D11 as CS, it’s for CLK pin, CS is D9.

And there is only one 3.3V.

Based on this image (from the campaign):

Looking at the two columns of pinholes on the lowers side, there appear to be two 3.3V sources. I believe the one on the left is the same one that powers the 3 Grove sockets above and is switched. The one on the right should be always on.

Unfortunately, I don’t have anymore all these pins on my OneBase !

see here : http://shop.sodaq.com/en/sodaq-one-base.html

I believe the issue is due to the D11 (AIN19 on the schematic pin) being attached to the switching mechanism on the ONEbase board. Since that pin is the clock pin, the components in that switching circuit are probably affecting the clock signal.

So I made a test, I have wired the SodaqOne with the base with cables.
I have just inversed D7 and D11.

So now the pin D11 on the base is the D7 on the one and vice versa.

So I have plug my SD on the base
MOSI -> D10
CS -> D9
MISO -> D8
CLK -> D7 => that is D11 on the sodaqOne

my sd is working and I can enable power on the groove 2/3 with setting pin D7 high (plugged to D11 on the base)

Do you thing that it can be possible in software to send CLK to D7 (AIN7 on the schematic pin) directly not to D11 (AIN19 on the schematic pin) ?

I have had a look, fortunately, the IO pin use for D7 can be used as a direct replacement.

I can make a sub-variant board which swaps the SCK to D7.

Thanks for your help

Maybe it will be better to set CS signal to D7. users can change this by software and so it will be possible to use the two groove (2/3 and 6/7) together with SPI.

And change CLK signal (actually D11) to D9 in place of CS.

So SPI bus will be :
CS: D7 (swap from D9 actually as AIN17)
MISO : D8
CLK : D9 (swap from D11 actually as AIN19)
MOSI : D10

Is this possible ?

D11 and D7 are both on PAD3 (of SERCOM0). It is not possible to configure the SPI pins so that PAD3 is used for SS or CS, it must be used for MISO, MOSI or SCK.

I have made a modification which switches the SCK pin to D7. I’m not sure how long it will be before I can get this into the official release. If you want, send me your email address and I can send you the two files that were modified.

Just to confirm that your modification is working well.

Thanks, problem resolved :wink:

Hey @stevejc @GabrielNotman
I would like to add a micro sd card to the sodaq one to log accelerometer data (as sending it via LoRaWAN is a challenge)

Can you let me know which size of micro sd card you used to get it working and the libraries?
Also would it work with the base board?

Regards,

You will need an SD card holder such as this breakout board:

Make sure that the IO levels are 3.3V.

You should then be able to test it with the standard SD sketches supplied with Arduino.

DO/DI are the MISO and MOSI pins. CS can be any IO pin you want, just make sure you specify it in the sketch.

1 Like