I’m using device DEV-14812 and DEV-12761. I’m aware there are compatibility issues with Arduino’s simple Serial usage, but I’m curious if the SPI interface has some kinks as well. I’m currently using Arduino 1.8.9 and the “Datalogger” sketch. I’ve changed the chipSelect value from 4 to 8 as instructed on the shield’s hookup guide. However, when I run the program I only get a boolean false (0) for the SD.begin(); function. Is there anything I’m missing? My libraries and drivers are up to date as far as I’m aware, since I can run a simple blink sketch just fine. Thank you and I hope this helps others.
Hi Brandon,
That is strange. According to our [SERCOM Tutorial, the RedBoard Turbo should have SPI pins on the standard Uno pinout (D11-13) so you should have no issue with using the microSD shield without any modifications. I have a feeling it is related to them not being explicitly labeled as MISO, MOSI, and SCK. I will test this here and let you know what I find out. In the meantime, you could try soldering a [2x3 female header to the legacy SPI port on the microSD shield so you can connect to the 2x3 SPI header on the RedBoard Turbo. That should work, but there may be something else regarding how the SD library is set up that is not working with the SAMD21 on the Turbo. I’ll get back to you once I’ve tested this.](Header - 2x3 (Female, 0.1") - PRT-13010 - SparkFun Electronics)](Adding More SERCOM Ports for SAMD Boards - SparkFun Learn)
With the exception of a software solution, the hard wiring worked without issue. This issue should help others running across the same thing.
Great! Just one note anyone trying to do this, make sure to leave the 5V pin on the SD Shield disconnected on that 2x3 header as the RedBoard Turbo has a 3.3V rail on that same pin. Connecting those two and powering it may damage the 3.3V rail on the RedBoard Turbo.
A software solution would probably be best here to set up an SPI bus on D11-13 since, as far as I could tell, there is not a default SPI bus there on the Turbo. Following the steps in that tutorial should work but I ran into some compatibility issues with the Arduino SD library so it may also require some modification of that library or using a different SD library.
I am having a similar issue with the RedBoard Turbo connected to a Sparkfun GPS Logger Shield. I got the GPS part working, as well as an extra UART through SERCOM on pins D2 and D3 to communicate with a 4D Systems LCD Display. This is all working as good as I could have hoped, but I cannot get the SD card access part to work.
In another post I identified a possible cause: the fact that on the Redboard Turbo, the Legacy SPI pins and the “usual” SPI pins on D10-D13 actually route to different physical pins on the SAMD21. I would think that this requires that the existing SPI port select jumpers on the GPS Logger Shield must be cut, or else the shield would short the D10-D13 pins to the legacy SPI pins, which connect to a second port on the SAMD21 (as far as I can tell).
I am still curious as to how to how the spi.h and sd.h libraries will work with the Turbo’s SPI ports, and how would we differentiate between the two in our sketches? From what I can see on the documentation and the graphical data sheet for the Turbo, it shows both the legacy and the D10-D13 SPI ports labeled as such, (even though the D10-D13 pins are not silkscreened to that effect on the board itself).
As it stands, the only SPI pin that we explicitly define in our sketches is CS, which as far as I can tell could be any pin configured as an output. So at what point, or where do we identify which SPI port we intend to use when we write our sketch?
I think you hinted that perhaps, even though the graphical datasheet labels D10-D13 as an SPI port, we may need do go in an explicitly configure those pins as such using the same process outlined in the tutorial for assigning additional comm ports, as I did when I added another UART to my project.
Now that I have corrected the SPI port select jumper issue on my Logger Shield, (I cut the traces between the center pad and the legacy SPI side), and assuming having those ports shorted together did not damage the RedBoard, I still cannot get the SD Card example sketches from either the GPS Logger Shield hookup guide, or the SD Card Reader Shield to function.
My next move will be to attempt to define the D10-D13 pins as an additional SPI port through SERCOM, then I will try the sketches again. In the meantime I am still waiting to hear from anyone who has got the GPS Logger Shield to function with the RedBoard Turbo, as well as anyone who has at least achieved reliable SPI communication through the RedBoard’s D10-D13 port.
As yet I have not tried to hardwire the GPS Logger Shield to the ICSP port for SPI, but I might give it a whirl if I cannot get the D10-D13 port to work. I prefer D10-D13 as it would obviously result in a cleaner project.