cancel
Showing results for 
Search instead for 
Did you mean: 

ADC DMA and interrupt

Arman Ilmak
Senior

Hey.

Im using adc dma to transfer data from adc to memory. After each sequence of conversion I need an interrupt.

My first question is that is using dma in my case something useless?

My second question is that after adc sequence of conversion interrupt flag is set,can I immediately read data from my dma buffer or the data is not transferred to memory yet and i need to get some flag from dma?

1 ACCEPTED SOLUTION

Accepted Solutions

DMA can generate a HT and TC to indicate half or all the buffer full.

You can use these to determine the inactive half for a ping pong buffer.

When you get the DMA interrupt the data is already in the buffer. The ADC will continue, so the buffer will continue to update/change.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2

DMA can generate a HT and TC to indicate half or all the buffer full.

You can use these to determine the inactive half for a ping pong buffer.

When you get the DMA interrupt the data is already in the buffer. The ADC will continue, so the buffer will continue to update/change.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Arman Ilmak
Senior

__HAL_DMA_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CCR & (__INTERRUPT__)))

Should I use this macro?

In the adc it has a __HAL_ADC_GET_IT_flag that i use .when i use __HAL_adc_GET_IT_SOURCE it doesnt work.Bur=t dma dont have __HAL_DMA_GET_IT_flag.What should i do?