Skip to content

Commit

Permalink
Enable SPI DMA receive before transmit on AT32 (betaflight#12368)
Browse files Browse the repository at this point in the history
* Enable DMA rx before tx

* Update bus_spi_at32bsp.c

Typo
  • Loading branch information
SteveCEvans authored and davidbitton committed Feb 5, 2024
1 parent a555a1c commit 64970c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/drivers/at32/bus_spi_at32bsp.c
Expand Up @@ -230,8 +230,11 @@ void spiInternalStartDMA(const extDevice_t *dev)
xDMA_Cmd(streamRegsTx, TRUE);
xDMA_Cmd(streamRegsRx, TRUE);

spi_i2s_dma_transmitter_enable(dev->bus->busType_u.spi.instance, TRUE);
/* Enable the receiver before the transmitter to ensure that not bits are missed on reception. An interrupt between
* the transmitter and receiver being enabled can otherwise cause a hang.
*/
spi_i2s_dma_receiver_enable(dev->bus->busType_u.spi.instance, TRUE);
spi_i2s_dma_transmitter_enable(dev->bus->busType_u.spi.instance, TRUE);

} else {
// Use the correct callback argument
Expand Down

0 comments on commit 64970c6

Please sign in to comment.