Skip to content

Commit 6815ce6

Browse files
committed
KSDK2 - fix SPI
When the function spi_master_write is called a transfer will occur and set the end of queue flag. This disables further SPI transfers which causes the next SPI transfer to hang forever. This patch clears the end of queue flag so SPI does not hang after the first transfer.
1 parent 88ac7d8 commit 6815ce6

File tree

2 files changed

+2
-2
lines changed
  • hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS

2 files changed

+2
-2
lines changed

hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K22F/spi_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int spi_master_write(spi_t *obj, int value) {
108108
// wait rx buffer full
109109
while (!spi_readable(obj));
110110
rx_data = DSPI_ReadData(spi_address[obj->instance]);
111-
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag);
111+
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag | kDSPI_EndOfQueueFlag);
112112
return rx_data & 0xffff;
113113
}
114114

hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/spi_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int spi_master_write(spi_t *obj, int value) {
108108
// wait rx buffer full
109109
while (!spi_readable(obj));
110110
rx_data = DSPI_ReadData(spi_address[obj->instance]);
111-
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag);
111+
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag | kDSPI_EndOfQueueFlag);
112112
return rx_data & 0xffff;
113113
}
114114

0 commit comments

Comments
 (0)