aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-25 21:35:32 -0800
committerpx4dev <px4@purgatory.org>2013-01-25 21:35:32 -0800
commit82f72b96de81478fb5d627be30a2f81ef2c5135f (patch)
tree18d23a76ae74bb4d90f9531eb2850e1cafca78f1 /apps/px4io
parent24f6c6b121ea87b26a2c5cac933089be496a28b6 (diff)
downloadpx4-firmware-82f72b96de81478fb5d627be30a2f81ef2c5135f.tar.gz
px4-firmware-82f72b96de81478fb5d627be30a2f81ef2c5135f.tar.bz2
px4-firmware-82f72b96de81478fb5d627be30a2f81ef2c5135f.zip
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.
Diffstat (limited to 'apps/px4io')
-rw-r--r--apps/px4io/i2c.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/apps/px4io/i2c.c b/apps/px4io/i2c.c
index 174ec2813..bbb72360b 100644
--- a/apps/px4io/i2c.c
+++ b/apps/px4io/i2c.c
@@ -158,6 +158,9 @@ i2c_interrupt(int irq, FAR void *context)
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 */
(void)rSR1; /* as recommended, re-read SR1 */
uint16_t sr2 = rSR2;
@@ -166,13 +169,11 @@ i2c_interrupt(int irq, FAR void *context)
/* we are the transmitter */
direction = DIR_TX;
- stm32_dmastart(tx_dma, NULL, NULL, false);
} else {
/* we are the receiver */
direction = DIR_RX;
- stm32_dmastart(rx_dma, NULL, NULL, false);
}
}