2018-06-13 12:48 PM
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 #dma2018-06-14 12:43 AM
- 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
2018-06-14 08:19 AM
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?
2018-06-14 10:54 AM
Toggle a GPIO at beginning and end of the ISRs (one GPIO for each). Connect oscilloscope or logic analyzer and observe.
JW