2025-07-10 11:14 PM
Hello,
I want to use MCU pin A6 for something else and OPAMP2 to ADC2-IN3 shall be internally connected only.
G4 Reference manual page 779 figure 171 says:
In this case, the I/O on which is mapped the OPAMPx_VOUT is free and can be used for another purpose. In standalone mode, VOUT pin is disconnected from the OPAMP output and the gain cannot be set by an external resistors (in this case OPAMP can be used only as comparator).
When I look at MCSDK generated code I see, that OPAINTOEN is disabled. According to docu above this means, OPAMP out is not connected to ADC ???
/* USER CODE END OPAMP1_Init 1 */
OPAMP_InitStruct.PowerMode = LL_OPAMP_POWERMODE_NORMALSPEED;
OPAMP_InitStruct.FunctionalMode = LL_OPAMP_MODE_PGA_IO0_BIAS;
OPAMP_InitStruct.InputNonInverting = LL_OPAMP_INPUT_NONINVERT_IO0;
LL_OPAMP_Init(OPAMP1, &OPAMP_InitStruct);
LL_OPAMP_SetInputsMuxMode(OPAMP1, LL_OPAMP_INPUT_MUX_DISABLE);
LL_OPAMP_SetInternalOutput(OPAMP1, LL_OPAMP_INTERNAL_OUPUT_DISABLED);
LL_OPAMP_SetPGAGain(OPAMP1, LL_OPAMP_PGA_GAIN_16_OR_MINUS_15);
LL_OPAMP_SetTrimmingMode(OPAMP1, LL_OPAMP_TRIMMING_FACTORY);
And when I change the line to LL_OPAMP_INTERNAL_OUPUT_ENABLED, code is not working anymore.
Questions:
Thanks,