I succeed to put on work an Arduino Due, an Ethernet shield, a SD card and a MP3 Shield from Sparkfun, using the following libraries: - Ethernet library from Arduino. Use extended SPI functions with pin 10 as chip select - SdFat library from Bill Greiman. Use former SPI functions. Chip select is 9 - SFEMP3Shield from Bill Porter and Michael Flaga. I modified it and use extended SPI functions with pin 4 as chip select
All of them used intensively the SPI bus. Of course, it did not work at first try. So I read (all ?) the posts about SPI and Due in this forum, and I make a lot of tries. I will summarize all the information I read and discover about SPI and Due.
pins for Chip Select. It can be any digital pin of Arduino Due. But only pins 4, 10 and 52 gives advantages of extended SPI
particularity of pin 52. It is the "Board Spi default chip select". BOARD_SPI_DEFAULT_SS is defined in arduino-1.5.1r2\hardware\arduino\sam\variants\arduino_due_x\variant.h as BOARD_SPI_SS2 defined in the same file as pin 52 That is to say that calling SPI.begin() is the same as calling SPI.begin( 52 ). So if you have a device using former SPI functions ( like SdFat ) , whatever it use a different pin for chip select, you cannot use pin 52 as chip select for an other device.
pinmode( CS, OUTPUT ) . Do not include this instruction in your sketch for pins 4 and 10.
advantages of extended SPI library? With other pins than 4, 10 and 52: none. When you have 2 or more devices using SPI, you have to reprogram attributes (speed, datamode, ...) and to set chip select to low before doing a transfer. If you read from a device to write to an other (ethernet to SD card, SD card to MP3, ...), this is a big constrain. With extended SPI using pins 4, 10 or 52, no need to do this. Only call SPI.transfer
use of additional parameter SPI_CONTINUE or SPI_LAST (the default) with SPI.transfer . I have no absolute answer. Sometime it works without specifying SPI_CONTINUE, sometime it works only if you specify it, sometime it don't work if you specify it.
I hope this would help. Any body has more information?