diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-03-03 14:57:32 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-03-03 14:57:32 +0000 |
commit | b5650c045732a833ab9bb9ae44a6be1f604bb9c1 (patch) | |
tree | babaed0dc002482a17f4f1f2ccafe1938b99f74d /os/hal/ports/STM32 | |
parent | 8c4653a41374ecac0b50b874e1e0203de8d28487 (diff) | |
download | ChibiOS-b5650c045732a833ab9bb9ae44a6be1f604bb9c1.tar.gz ChibiOS-b5650c045732a833ab9bb9ae44a6be1f604bb9c1.tar.bz2 ChibiOS-b5650c045732a833ab9bb9ae44a6be1f604bb9c1.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6749 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/STM32')
-rw-r--r-- | os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c b/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c index e95ac27ba..26f6bb5fc 100644 --- a/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c +++ b/os/hal/ports/STM32/LLD/SPIv1/i2s_lld.c @@ -419,14 +419,22 @@ void i2s_lld_start_exchange(I2SDriver *i2sp) { */
void i2s_lld_stop_exchange(I2SDriver *i2sp) {
- /* Stop DMAs.*/
- if (NULL != i2sp->dmatx)
+ /* Stop TX DMA, if enabled.*/
+ if (NULL != i2sp->dmatx) {
dmaStreamDisable(i2sp->dmatx);
- if (NULL != i2sp->dmarx)
- dmaStreamDisable(i2sp->dmarx);
- /* Stop transfer.*/
+ /* From the RM: To switch off the I2S, by clearing I2SE, it is mandatory
+ to wait for TXE = 1 and BSY = 0.*/
+ while ((i2sp->spi->SR & (SPI_SR_TXE | SPI_SR_BSY)) != SPI_SR_TXE)
+ ;
+ }
+
+ /* Stop SPI/I2S peripheral.*/
i2sp->spi->I2SCFGR &= ~SPI_I2SCFGR_I2SE;
+
+ /* Stop RX DMA, if enabled.*/
+ if (NULL != i2sp->dmarx)
+ dmaStreamDisable(i2sp->dmarx);
}
#endif /* HAL_USE_I2S */
|