Go Down

Topic: [Solved] SdFat library and SS (Read 653 times) previous topic - next topic

ieee488

Mar 28, 2018, 07:17 pm Last Edit: Mar 29, 2018, 04:00 am by ieee488
In ReadWrite.ino, there is the definition #define SD_CS_PIN SS.

In which file is the value SS defined ?


I have to change SS to 4 in the sketch ( #define SD_CS_PIN 4  )  in order for the SeeedStudio SD Card Shield to work.



.

marco_c

#1
Mar 28, 2018, 09:00 pm Last Edit: Mar 29, 2018, 01:18 am by marco_c
SS usually defined in the Arduino library. For the Uno it is pin 10.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

ieee488


pert

SS is defined in the pins_arduino.h file for the variant (as defined in boards.txt) of the currently selected board. For example, if you are compiling for Uno, you can see it uses the standard variant:
https://github.com/arduino/ArduinoCore-avr/blob/master/boards.txt#L78
Code: [Select]
uno.build.variant=standard
Then if you open variants/standard/pins_arduino.h:
https://github.com/arduino/ArduinoCore-avr/blob/master/variants/standard/pins_arduino.h#L38-L43
Code: [Select]
#define PIN_SPI_SS    (10)
#define PIN_SPI_MOSI  (11)
#define PIN_SPI_MISO  (12)
#define PIN_SPI_SCK   (13)

static const uint8_t SS   = PIN_SPI_SS;

Go Up