diff options
Diffstat (limited to 'platforms/arm/k20/fastspi_arm_k20.h')
-rw-r--r-- | platforms/arm/k20/fastspi_arm_k20.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platforms/arm/k20/fastspi_arm_k20.h b/platforms/arm/k20/fastspi_arm_k20.h index f342caf8..01b5fc82 100644 --- a/platforms/arm/k20/fastspi_arm_k20.h +++ b/platforms/arm/k20/fastspi_arm_k20.h @@ -276,7 +276,12 @@ public: } static void waitFully() __attribute__((always_inline)) { - while( (SPIX.SR & 0xF000) > 0); + // Wait for the last byte to get shifted into the register + while( (SPIX.SR & 0xF000) > 0) { + // reset the TCF flag + SPIX.SR |= SPI_SR_TCF; + } + // wait for the TCF flag to get set while (!(SPIX.SR & SPI_SR_TCF)); SPIX.SR |= (SPI_SR_TCF | SPI_SR_EOQF); } |