I try to enable the Dual ADC mode on STM32F303 without success.
In dual mode, the ADC1 and ADC2 work simultaneously, and the ADC2 is the slave of ADC1.
The result of conversion is stored into the "ADC12_CDR" 32-bit register, of which the higher word "RDATA_SLV" contains the slave ADC result and the lower word "RDATA_MST" contains the master ADC result.
In my application is useful the "Regular Simultaneous Mode" given that the ADC1 and ADC2 have the same configuration exactly, and detect similar signals. (I suppose that the ADC conversions will be executed faster?)
To this, the "ADC12_CCR.DUAL" (bits 4:0 of ADCx_CCR register) should get "00110".
Here is my simple C code line:
Code: Select all
ADC12_CCR.DUAL = 0x06;
Here is also a copy from the code generated by STM32CubeIDE, when the dual mode is selected:C:\Users\FOTIOS\DOCUME~1\FLOW_C~1>arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Os -DSTM32 -DSTM32F3 -DSTM32F303xE -DUSE_HAL_DRIVER -DHSE_VALUE=24000000 -IC:\PROGRA~2\FLOWCO~1\COMPIL~1\STARM\batch\..\stm32cubeF3\Drivers\CMSIS\Include -IC:\PROGRA~2\FLOWCO~1\COMPIL~1\STARM\batch\..\stm32cubeF3\Drivers\CMSIS\Device\ST\STM32F3xx\Include -IC:\PROGRA~2\FLOWCO~1\COMPIL~1\STARM\batch\..\stm32cubeF3\Drivers\STM32F3xx_HAL_Driver\Inc -IC:\PROGRA~2\FLOWCO~1\COMPIL~1\STARM\batch\..\stm32cubeF3\Drivers\STM32F3xx_HAL_Driver\Inc\Legacy -IC:\PROGRA~2\FLOWCO~1\COMPIL~1\STARM\batch\..\inc -fmessage-length=0 -fdata-sections -ffunction-sections -w -c "ADC_STM.c" -o "ADC_STM_STM32F303xE_24000000\ADC_STM.o"
ADC_STM.c: In function 'main':
ADC_STM.c2: error: 'ADC12_CCR' undeclared (first use in this function)
// Calculation:
^
ADC_STM.c2: note: each undeclared identifier is reported only once for each function it appears in
Error(s) in build
C:\Program Files (x86)\Flowcode 7\compilers\STARM\batch\stm32comp.bat reported error code 1
Code: Select all
/** Configure the ADC multi-mode
*/
multimode.Mode = ADC_DUALMODE_REGSIMULT;
multimode.DMAAccessMode = ADC_DMAACCESSMODE_12_10_BITS;
multimode.TwoSamplingDelay = ADC_TWOSAMPLINGDELAY_1CYCLE;
if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK)
{
Error_Handler();
}