SD card shield with SPI sensor issues.

Hi all,

Just before I get into it I have searched for answers to this and have read a lot of stuff on having two SPI slaves running on the one board etc etc but I feel like this is different.

I am running a sparkfun micro SD shield into my chipkit max32 board (arduino MEGA copy, sort of). Also, I have an ADIS16210 accelerometer which runs into this board also.

I can get both working independently just fine.

I have the MISO, MOSI and CLK lines hooked up as per usual and have the SD slave select running on pin 40 (just an arbitrary pin) and the ADIS slave select is on 53.

Once I combine my two test sketches, I am unable to read registers from my ADIS. It just hangs at the command :

I have hard wired the pins on the micro SD shield to differenet places on the prototype area, so as not to use the pins on side and inadvertently double up on something.

I noticed that I do not need to manually set the slave select for the SD card to low everytime I read or write something to it. I am tipping this is handled in the SD.h library. Can someone confirm that?

Any ideas on why it would hang my sketch? I tried doing some things with setting slave select pins high and low to deliberately mess up my code in my test sketches and even that doesnt make it hang like it is.

I have both SS pins set to output and set HIGH in the setup.

Thank you in advance.

I have commented everything out in regards to the SD card from my code. Then just commented in the initialization.

As soon as the initialization happens, I am no longer able to use to SPI.transfer().

Has been fixed.
Needed to set the SPI clock speed AFTER I initialise the SD.