Arduino Forum

Products => MKR Boards => MKRZero => Topic started by: nrceptor on Dec 28, 2016, 06:22 pm

Title: SD card chipSelect setting?
Post by: nrceptor on Dec 28, 2016, 06:22 pm
I set up a MKRZero as shown in the example for the Weather_Data_Logger, downloaded the source and ran it with 2 different cards.  The SD cards were formatted and work on other Arduino boards.  The MKRZero board was installed under the Atmel Studio 7 IDE with Visual Micro for Arduino 1.6.  I always get as output
"chipSelect = 28
DataLogger Example:
Card failed, or not present"
I added println chipSelect to see what was going on and see it is selecting pin 28 (the code assigns "SS1"), which seems off.  I tried 4 and 10 with same result.  Others build the example and run the provided code with no reported problems.  What am I not getting right?  I have the Adafruit SD library loaded, which I needed for their logger shield, which uses pin 10, but RTCZero and DHT libraries are also installed.
Title: Re: SD card chipSelect setting?
Post by: sandeepmistry on Dec 29, 2016, 04:07 pm
Hi @nrceptor,

Pin 28 is the right chip select pin, however, please make sure you are using the latest version of the SD library. Version 1.1.0 is required for the MKRZero, as it uses a secondary SPI port.
Title: Re: SD card chipSelect setting?
Post by: sandeepmistry on Dec 30, 2016, 03:09 pm
@nrceptor could you download IDE v1.8.0 and try with that?

Also, it would be great if you could enable verbose build output via the IDE preferences and provide the log from the build output. Thanks.
Title: Re: SD card chipSelect setting?
Post by: nrceptor on Jan 01, 2017, 04:42 pm
This morning it is working perfectly!  :o  Even under 1.6.  All I did was to again take the card out to inspect the card holder and re-insert it, as I have done several times.  This time it started working.  Must have been corrosion/dirt on the contacts(?).  It is a new card so maybe it needed "breaking in" a bit. Thank you very much for your replies and apologies that it was a hardware problem!
Title: Re: SD card chipSelect setting?
Post by: yasunari on Jan 04, 2017, 01:52 am
Hi
MkrZero use

I also have the same problem Card failed, or not present"
"chipSelect = 28
DataLogger Example:
Card failed, or not present"

"chipSelect = SSI1" <= same problem

Does everyone work normal?

Use This
SD library. Version 1.1.0
IDE v1.8.0

The PIN name of this board(MkrZero) is
Where is the document located?
Title: Re: SD card chipSelect setting?
Post by: yasunari on Jan 05, 2017, 12:04 am
// MKRZero SD: SDCARD_SS_PIN
const int chipSelect = SS1;

About writing SD card,
Please tell me the correct name of the CS(chipSelect ) pin.
i try
SS1,SS,27,28 <-  All NG
Title: Re: SD card chipSelect setting?
Post by: sandeepmistry on Jan 05, 2017, 03:12 pm
Hi @yasunari,

This might be related to an issue introduced in v1.1.0 of the SD library. The SD slave select pin is 28.

There's a pull request on Github to fix it: https://github.com/arduino-libraries/SD/pull/29 (https://github.com/arduino-libraries/SD/pull/29)

Suggested work around in the meantime it to downgrade to v1.0.9 of the SD library using the IDE's Library manager.
Title: Re: SD card chipSelect setting?
Post by: yasunari on Jan 06, 2017, 03:03 am
Hi,
Thank you reply

select pin is 28.
v1.0.9 of the SD library

 ALL OK!
Thank you
Title: Re: SD card chipSelect setting?
Post by: sandeepmistry on Jan 06, 2017, 02:37 pm
Hi @yasunari,

Thanks for the update. Just to let you know, v1.1.1 of the SD library has been released with the fix.