Skip to content

Commit fa63b67

Browse files
committed
[HAL][KSDK] Fix issue with KSDK SPI timing
Depending on the format by default the Freescale SPI peripheral does not give proper delay between SPI transfers. So code has been added which sets half a period delay between SPI transfers.
1 parent e74074e commit fa63b67

File tree

1 file changed

+1
-0
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS

1 file changed

+1
-0
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/spi_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ void spi_frequency(spi_t *obj, int hz) {
9191
CLOCK_SYS_GetFreq(kBusClock, &busClock);
9292
uint32_t spi_address[] = SPI_BASE_ADDRS;
9393
DSPI_HAL_SetBaudRate(spi_address[obj->instance], kDspiCtar0, (uint32_t)hz, busClock);
94+
DSPI_HAL_CalculateDelay(spi_address[obj->instance], kDspiCtar0, kDspiAfterTransfer, busClock, 500000000 / hz); //Half clock period delay after SPI transfer
9495
}
9596

9697
static inline int spi_writeable(spi_t * obj) {

0 commit comments

Comments
 (0)