Timer Interrupt with DMA (ADC, SPI), non-blocking while loop?
Hi,
I always appreciate all members here for helping beginners like me :)
I am currently working on a project using Timer and ADC+SPI with DMA.
The main timer loop is running at 40kHz, and this frequency should be strictly guaranteed.
Two DMA process is also running with the timer, one is ADC and the other is SPI Comm.
I want to check if the two DMA process is done in the timer ISR and
do next procedure I need and while DMA process is being checked, I also want the timer to be continuously ticking.
The reason I want to use DMA is to make two peripherals work simultaneously so I can get two results in a shorter time.
At first, I tried just polling type of ADC and SPI comm.
SPI comm starts after ADC is done.
By doing so, it is easy to make the timer frequency strictly the same.
but what if ADC and SPI are working by DMA?
I thought it can be done parallelly like the follows:
"Do something" needs two data from ADC and SPI, therefore
it has to check if both works are done and move on to the Do something part.
The problem is :
I tried to make the priority of timer lower than DMA interrupts,
and use the while() loop in the timer to check the DMA status.
but it doesn't work properly, I think while() loop blocks and bothers the timer so the frequency is not guaranteed..
Could you please give me some advice to achieve this kind of thing?
or DMA doesn't help and the polling type is the answer to do so?
Thank you all!
Best,
IJo
