cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7, ADC1 Multi Channel Mode + Interrupt Mode (Not DMA, not polling mode) Possible?

VRapa
Associate II

I want to use ADC1 16 channels to read different analog values. So whenever there is a data in the channel then I want to read the 16 channel data in Interrupt mode. I dont want to use DMA Interrupt mode and Poll Conversion mode. Is it possible to do? What are the hal functions needed for that?

Generally HAL_ADC_Start_IT(&hadc1); is used to read the single channel only. Am I wrong?

2 REPLIES 2
berendi
Principal

Depending on the conversion speed, interrupts might be too slow to handle it.

My completely unofficial rule of thumb values based on my limited experience are as follows.

Reading the data register, storing it into a buffer, and clearing the interrupt flag should take 50 to 100 CPU cycles.

Doing the same with HAL functions might take 1000 to 2000 cycles. Yes, HAL has that much overhead.

If the sampling time is less than 100 cycles, forget interrupts and use DMA.

If the sampling time is less than 1000 cycles, consider using DMA as interrupts would eat a large portion of the available CPU time.

If the sampling time is less than 2000 cycles, forget using HAL.

If the sampling time is less than 20000 cycles, consider getting rid of HAL.

Use this as a starting point for implementing your ADC handler.

https://community.st.com/s/question/0D50X0000C8e3o2SQA/stm32h7-triggering-adc-with-tim6-trgo

Thank you for the information berendi