cancel
Showing results for 
Search instead for 
Did you mean: 

ADC & DMA disrupting SPI

Brother Theo
Associate II
Posted on June 13, 2018 at 21:48

Hi,

I have ADC & DMA working well, scanning 2 channels in circular mode using full and half full callback routines. It works swimmingly. I also have SPI transmissions happening off of a timer interrupt. The problem is the SPI transmissions are being disrupted by the ADC operation. I need the DAC timing to be solid, but is it jittery. If I disable the ADC by kiling the call to start the ADC-DMA cycle the SPI looks perfect, so I know its the ADC that is causing it. Is there a way to set priorities so the SPI dominates over the ADC system?

Thanks!

--Tim

#adc #dma
3 REPLIES 3
Posted on June 14, 2018 at 09:43

- set priority grouping so that ISRs can interrupt each other (in ARM's parlance, 'preempt') - you did not tell us your STM32 model, assuming it's based on Cortex-M4, read PM0214 description of AIRCR.PRIGROUP (and the somewhat confusingly namend Binary point subchapter); this is normally set by NVIC_SetPriorityGrouping() CMSIS function; and then individual ISR's priorities set by NVIC_SetPriority()

- reduce software overhead, e.g. if you use some 'library' such as Cube/HAL, get rid of it; also by employing DMA wherever possible (e.g. the timer-triggered-SPI)

JW

Posted on June 14, 2018 at 15:19

Processor is an STM32F070. I am using HAL for ADC and DMA. I already bypassed HAL for writing the SPI in order to speed it up. You are saying this may help with ADC and DMA as well?

Posted on June 14, 2018 at 17:54

Toggle a GPIO at beginning and end of the ISRs (one GPIO for each). Connect oscilloscope or logic analyzer and observe.

JW