6 years, 6 months ago.

Setting OPAMP2 as follower has no effect...

The title says it. I'm struggling in setting OPAMP2 as a simple voltage follower on a nucleo STM32L476RG board. So far, I've been trying using the code generated by STM32CubeMX, I have read the implementation of the lib in Mbed as well, tried to use them, and even tried to set the bits in the registers directly, all these three attempts gets to an output stuck to 0V, whatever the signal I set on VinP. I 'm using à 0-2V range input signal on PA6, and try to check it out on PB0. Does anybody knows what I could be missing ??

Code generated by STM32CubeMX: ------------------- hopamp2.Instance = OPAMP2; hopamp2.Init.PowerSupplyRange = OPAMP_POWERSUPPLY_LOW; hopamp2.Init.Mode = OPAMP_FOLLOWER_MODE; hopamp2.Init.NonInvertingInput = OPAMP_NONINVERTINGINPUT_IO0; hopamp2.Init.PowerMode = OPAMP_POWERMODE_NORMAL; hopamp2.Init.UserTrimming = OPAMP_TRIMMING_FACTORY; if (HAL_OPAMP_Init(&hopamp2) != HAL_OK) { printf("\r\n!!!Error on Opamp configuration\r\n"); } else { printf("\r\nOpamp configuration OK\r\n"); } -------------- Despite the fact I got the 'OK' message on my debug TX, the output remains at 0V I tried then to add: HAL_OPAMP_Start(&hopamp2); But still with the same result.

I also tried to set manually the bits, refering to the datasheet:

1 - bits after bits: SET_BIT(OPAMP2->CSR,0x04); SET_BIT(OPAMP2->CSR,0x08); SET_BIT(OPAMP2->CSR,0x01);

2 - setting the whole register at once: MODIFY_REG(OPAMP2->CSR,0x0D,0x0D);

All that leading to PB0 stuck at 0V. What Am I missing ?

Be the first to answer this question.