2024-08-26 07:20 PM
I am using NUCLEO-F756ZG. I intend to use two of the ADCs but in different conditions. ADC1 is configured for DMA and triggered by TIM1 to run at high speed (1 Msps), ADC2 is configured for interrupt mode and triggered by TIM8 to run at low speed (1~20 sps).I have two questions.
1. I want to use different callbacks for the two ADCs. I know about HAL_ADC_RegisterCallback function. Should I be using them right after MX_ADCx_Init call or modify the MX_ADCx_Init to register the callbacks during init?
2. Looking at CubeMX generated IRQHandler, and since ADC interrupt is global for all 3 ADCs, it seems that interrupt will be called after each sampling of ADC1 too. How should I modify it so that ADC1 doesn't call interrupt and only ADC2 does. I only need to process ADC1 data after full DMA transfer completes. Should I leave an empty callback for ADC1 and move the intended routine to DMA_xferCpltCallback?
Thanks for your time. Due to situations, I am stuck with using HAL and can't write up everything from scratch. I appreciate all help.