cancel
Showing results for 
Search instead for 
Did you mean: 

DMA counter resetting by itself

za kia
Associate II
Posted on March 19, 2018 at 22:09

Hello,

Could someone tell me what I am doing wrong here?

I would like to transmit on SPI (as slave) using DMA, and so have tied SPI transmit to a DMA channel, and set up an ISR to capture 'transmit completed' interrupt from the DMA. But this interrupt gets called even though there are no SPI clocks present.

To test this I set up my DMA pointers and then set the counter to 2. Now, as soon as I enable the DMA, the count goes to zero.

Shouldn't the counter decrement after a byte gets transmitted? And isn't it that a byte gets transmitted on SPI only when a clock byte has been received from the master? I am scoping the clock line and I see no clocks, obviously since the host has been stopped.

Why is this counter getting reset?

This is on an STM32F072VBT6.

Thanks very much.

2 REPLIES 2
Posted on March 20, 2018 at 16:25

The 'F0 SPI has a FIFO which can accomodate 4 bytes, so as soon as you enable SPI, up to 4 bytes are transferred by the DMA into SPI's buffer before the first data gets transmitted.

JW

za kia
Associate II
Posted on March 28, 2018 at 15:52

Thank you.