Skip to content

Commit 32617d5

Browse files
authored
Merge pull request #2925 from arturo182/imx-spi
mimxrt1010: Increase max SPI speed
2 parents ebfc1f2 + f92d53e commit 32617d5

File tree

2 files changed

+3
-3
lines changed
  • ports/mimxrt10xx

2 files changed

+3
-3
lines changed

ports/mimxrt10xx/common-hal/busio/SPI.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ STATIC void config_periph_pin(const mcu_periph_obj_t *periph) {
5858
| IOMUXC_SW_PAD_CTL_PAD_SRE(0));
5959
}
6060

61-
#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv)))
61+
#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1))
6262

6363
void spi_reset(void) {
6464
for (int i = 0; i < MAX_SPI; i++) {

ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 62500000UL
5656
#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 125000000UL
5757
#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL
58-
#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL
58+
#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 130900000UL
5959
#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL
6060
#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 62500000UL
6161
#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL
@@ -137,7 +137,7 @@ void clocks_init(void) {
137137
CLOCK_DisableClock(kCLOCK_Lpspi1);
138138
CLOCK_DisableClock(kCLOCK_Lpspi2);
139139
/* Set LPSPI_PODF. */
140-
CLOCK_SetDiv(kCLOCK_LpspiDiv, 7);
140+
CLOCK_SetDiv(kCLOCK_LpspiDiv, 2);
141141
/* Set Lpspi clock source. */
142142
CLOCK_SetMux(kCLOCK_LpspiMux, 1);
143143
/* Disable TRACE clock gate. */

0 commit comments

Comments
 (0)