mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-07 03:31:36 +08:00
Move DMA start for tx/rx into the gap where SCL is still stretched so that there is no risk of receiving the first byte before DMA starts.
This commit is contained in:
+3
-2
@@ -158,6 +158,9 @@ i2c_interrupt(int irq, FAR void *context)
|
|||||||
|
|
||||||
if (sr1 & I2C_SR1_ADDR) {
|
if (sr1 & I2C_SR1_ADDR) {
|
||||||
|
|
||||||
|
stm32_dmastart(tx_dma, NULL, NULL, false);
|
||||||
|
stm32_dmastart(rx_dma, NULL, NULL, false);
|
||||||
|
|
||||||
/* clear ADDR to ack our selection and get direction */
|
/* clear ADDR to ack our selection and get direction */
|
||||||
(void)rSR1; /* as recommended, re-read SR1 */
|
(void)rSR1; /* as recommended, re-read SR1 */
|
||||||
uint16_t sr2 = rSR2;
|
uint16_t sr2 = rSR2;
|
||||||
@@ -166,13 +169,11 @@ i2c_interrupt(int irq, FAR void *context)
|
|||||||
/* we are the transmitter */
|
/* we are the transmitter */
|
||||||
|
|
||||||
direction = DIR_TX;
|
direction = DIR_TX;
|
||||||
stm32_dmastart(tx_dma, NULL, NULL, false);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* we are the receiver */
|
/* we are the receiver */
|
||||||
|
|
||||||
direction = DIR_RX;
|
direction = DIR_RX;
|
||||||
stm32_dmastart(rx_dma, NULL, NULL, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user