You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit: This issue was for 1.8.11. The problem of SCK rate higher than SPISettings is still in 1.8.13 but max clock is limited to 12 MHz. A requested max clock of 9 MHz still results in 12 MHz.
I found this problem while using a scope to investigate SPI signals on an SD card. I was surprised to see 24 MHz SCK whenever clock was greater than 12 MHz in SPISetting.
Edit: This issue was for 1.8.11. The problem of SCK rate higher than SPISettings is still in 1.8.13 but max clock is limited to 12 MHz. A requested max clock of 9 MHz still results in 12 MHz.
I found this problem while using a scope to investigate SPI signals on an SD card. I was surprised to see 24 MHz SCK whenever clock was greater than 12 MHz in SPISetting.
SPISettings(uint32_t clock, BitOrder bitOrder, SPIMode dataMode)
The problem appears to be this function at about line 362 of samd/1.8.11/cores/arduino/SERCOM.cpp.
I replaced it with this function which seems give the best rate less or equal to the clock value in SPISettings.
This function is based on ceil((double)a/b) for integer a, b is (a + b - 1)/b.
Here are values of speedMax requested in SPISetting, speedOld for the current function and speedNew for the new function.
Here is a sketch that calculated the above table:
The text was updated successfully, but these errors were encountered: