Workaround for Timer synced DMA SPI reception
I am working with CubeMx and the HAL Driver on Nucleo H7 (STM32H743ZI) Board. Now i want to implement a SPI Rx communication with an external ADC. The data from the ADC is 32bit wide. The SPI reception should happen without much CPU intervention.
My idea was to set up a timer (~100kHz) which triggers a DMA request. The DMA triggers the SPI Rx process and transfers the Data to a specific value in D2 RAM. After the DMA transfer an interrupt should be generated: the data that was transfered by DMA, is simply sumed up and a counter-value is up counted.
The Idea is to sum up the ADC data over a specific time and calculate the average value of the result afterwards.
I tried nearly every setting in CubeMX to sync the DMA transfer with the timer but non of my attempts worked. Also the examples from the Cube_FW_H7 doesn't give me a clue.
The only way i managed the problem was set up a new DMA transfer in timer-elapsed callback. But this uses much of CPU time which i maybe need for other tasks.
Does anyone has a workaround for my problem?
Is there also a possibility to sync the SPI rx process to a timer without DMA?
Thanks for you answer.
#spi #timer #hal #h7 #sync #dma-spi #dma