sd library 1.1.1 new begin(clock, pin) max clock ?


New version of sd library introduce SD.begin(clock, pin) function.

I want to know what should be the maximum clock value possible, for UNO or DUE for example ?



They have not updated the SD library documentation but since SD uses SPI my guess would be that the value is passed to the SPI library. The SPI library calculates which available clock divider will give you the highest clock below the specified limit. I think you are intended to specify the maximum rate of the SPI interface of your SD card. If not specified you probably get a value of 4 MHz (the default for SPI). The UNO can go up to 8 MHZ.

For more detail, see the library source code.

You're right.

the command that use this parameter in on Sd2Card.cpp :

#ifdef USE_SPI_LIB
// set the SPI clock frequency
uint8_t Sd2Card::setSpiClock(uint32_t clock)
  settings = SPISettings(clock, MSBFIRST, SPI_MODE0);
  return true;

But it is hard to know what is the max for arduino DUE for example and the mar for an sd card...