From 6c75c5909e7f72897ddb737c6459ea6bbfab3900 Mon Sep 17 00:00:00 2001 From: px4dev Date: Fri, 25 Jan 2013 21:58:55 -0800 Subject: Move the DMA start to immediately after setting it up; less latency at interrupt time, and no chance of getting start/stop calls out of sync. --- apps/px4io/i2c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/px4io/i2c.c b/apps/px4io/i2c.c index bbb72360b..dca5ceb1d 100644 --- a/apps/px4io/i2c.c +++ b/apps/px4io/i2c.c @@ -158,9 +158,6 @@ 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; @@ -222,6 +219,8 @@ i2c_rx_setup(void) DMA_CCR_PSIZE_32BITS | DMA_CCR_MSIZE_8BITS | DMA_CCR_PRIMED); + + stm32_dmastart(rx_dma, NULL, NULL, false); } static void @@ -283,6 +282,8 @@ i2c_tx_setup(void) DMA_CCR_PSIZE_8BITS | DMA_CCR_MSIZE_8BITS | DMA_CCR_PRIMED); + + stm32_dmastart(tx_dma, NULL, NULL, false); } static void -- cgit v1.2.3