cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103RB Nucleo - Dual Mode ADC External Trigger not enabled

XPChi
Associate II

I've had a look at similar threads, however they have been set to read only.
I have ADC1 and ADC2 setup in regular simultaneous mode with DMA transfer enabled. Only ADC1 is converting and the data register which contains ADC2 data is empty (0x000). I have stepped through my code with the debugger and seen that the EXTTRIG bit for ADC2 is not being enabled.

The reference manual explains that EXTTRIG should be set in the control register for both ADCs in dual mode.
The following HAL function should be setting that bit, however, it remains 0.

HAL_ADCEx_MultiModeStart_DMA(&hadc1, adc, 2);


I have tried to manually set this bit in the register but still no conversion is being triggered on ADC2

 ADC2 -> CR2 |=(1U<<20);

 If there's something I am missing, any advice would be appreciated.
Note: the ADCs have the same sampling time (71.5 cycles) on different channels and the ADC clock is set to 12MHz.

1 REPLY 1
XPChi
Associate II

Found my mistake. 

The start function for the secondary ADC needs to be called to enable the EXTTRIG bit and in turn enable conversion of ADC2

HAL_ADC_Start(&hadc2);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, adc, 2);