Skip to content

Commit 14bb73b

Browse files
author
Nathan Seidle
committed
Limit SPI max speed to HAL limit of 48MHz.
1 parent 7499b1a commit 14bb73b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libraries/SPI/src/SPI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ void SPIClass::config(SPISettings settings)
122122
{
123123
memset((void *)&_config, 0x00, sizeof(am_hal_iom_config_t)); // Set the IOM configuration
124124
_config.eInterfaceMode = AM_HAL_IOM_SPI_MODE;
125+
126+
if (settings.clockFreq > AM_HAL_IOM_MAX_FREQ)
127+
settings.clockFreq = AM_HAL_IOM_MAX_FREQ;
128+
125129
_config.ui32ClockFreq = settings.clockFreq;
126130
_config.eSpiMode = settings.dataMode;
127131
_order = settings.bitOrder;

0 commit comments

Comments
 (0)