Skip to content

Commit

Permalink
SPI: provide a hook to set the minimum SPI frequency
Browse files Browse the repository at this point in the history
On Giga, the system will complain loudly if the frequency selected is too low
```<err> spi_ll_stm32: Unsupported frequency 400000Hz, max 120000000Hz, min 937500Hz```
Let's try to keep this at minimum or change when we'll be able to grab the same infor from a macro/API provided by zephyr
  • Loading branch information
facchinm committed Dec 9, 2024
1 parent 5eb1f50 commit c97b49f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libraries/SPI/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ void arduino::ZephyrSPI::usingInterrupt(int interruptNumber) {
void arduino::ZephyrSPI::notUsingInterrupt(int interruptNumber) {
}

#ifndef SPI_MIN_CLOCK_FEQUENCY
#define SPI_MIN_CLOCK_FEQUENCY 1000000
#endif

void arduino::ZephyrSPI::beginTransaction(SPISettings settings) {
memset(&config, 0, sizeof(config));
config.frequency = settings.getClockFreq();
config.frequency = settings.getClockFreq() > SPI_MIN_CLOCK_FEQUENCY ? settings.getClockFreq() : SPI_MIN_CLOCK_FEQUENCY;
auto mode = SPI_MODE_CPOL | SPI_MODE_CPHA;
switch (settings.getDataMode()) {
case SPI_MODE0:
Expand Down

0 comments on commit c97b49f

Please sign in to comment.