cancel
Showing results for 
Search instead for 
Did you mean: 

Reusing OPAMP OUT pin for other purpose

c_dev05
Associate III

Hello,

I want to use MCU pin A6 for something else and OPAMP2 to ADC2-IN3 shall be internally connected only.

c_dev05_0-1752214168052.png

G4 Reference manual page 779 figure 171 says:

  1. opamp_out can be redirected internally to an ADC channel by setting OPAINTOEN bit.

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:

  • is the documentation in the reference manual wrong?
  • is it not possible to use the pin A6 for another purpose?
    • if it is possible, how?

Thanks,

 

0 REPLIES 0