2014-01-06 05:03 PM
I have a STM32 discovery board configured in slave mode receiving commands over SPI. When it receives a specific command byte, it activates DMA and sends back a set number of bytes back. I have a print statement at the beginning of my rx_isr function. I've noticed that when I receive the command byte, DMA is activated and begins to work (confirmed with the logic analyzer) but my rx_isr is called an additional 4 times. I would assume that since the DMA controller is now handling the SPI communication, I shouldn't receive any more calls to my isr. Does anyone have an idea what might be causing this?
#dma #spi2014-01-08 01:06 AM
Interrupts and DMA have different enable bits in SPI_CR2. Unless you disable the interrupts (by clearing RXNEIE bit), there will be an interrupt upon every received byte, whether handled by DMA or not.
JW2014-01-08 03:37 PM
This makes sense, except I only receive 4 bytes back? In total I'm sending back 160 bytes back. It should either never trigger, or trigger for each and every one of those bytes, right?
2014-01-09 01:34 AM
Hi
'' except I only receive 4 bytes back? In total I'm sending back 160 bytes back.'' '' I have a print statement at the beginning of my rx_isr function.'' SPI and DMA are very fast in comparison with most display functions. It may be that the display function is overwhelmed and looses the other displays, particularly if on buffer overflow it discards data.