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
The SAMD SPI library has several problems with setting SPI speed. I found these problems while using a logic analyzer to investigate a problems reported by a user in my SdFat library.
The actual speed is greater than or equal to the maxSpeed requested in SPISettings(maxSpeed, dataOrder, spiMode). For example if maxSpeed is 13 MHZ, the actual result is 24 MHz. The actual speed is only correct if maxSpeed exactly divides 24 MHz.
If the requested speed is less than about 94 kHz, divisor overflow happens for the 8-bit SERCOM BAUD register.
The SAMD SPI library has several problems with setting SPI speed. I found these problems while using a logic analyzer to investigate a problems reported by a user in my SdFat library.
The actual speed is greater than or equal to the maxSpeed requested in
SPISettings(maxSpeed, dataOrder, spiMode).
For example if maxSpeed is 13 MHZ, the actual result is 24 MHz. The actual speed is only correct if maxSpeed exactly divides 24 MHz.If the requested speed is less than about 94 kHz, divisor overflow happens for the 8-bit SERCOM BAUD register.
SAMD51 seems to work at 24 MHz but SAMD21 should be limited to 12 MHz max see:
https://microchipsupport.force.com/s/article/SPI-max-clock-frequency-in-SAMD-SAMR-devices
The problems are in uint8_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate) at about line 389 of this file:
https://github.com/adafruit/ArduinoCore-samd/blob/master/cores/arduino/SERCOM.cpp
I tried the following fix but only did minimal tests on a Feather M0 SAMD21 and a Feather M4 Express SAMD51.
The text was updated successfully, but these errors were encountered: