AnsweredAssumed Answered

STM32L4, OPAMP calibration

Question asked by Vinci on Nov 7, 2015
Latest reply on Nov 17, 2015 by Vinci

Has anyone gotten the OPAMP calibration with STM32L4 (or similar) controllers working so far? I've initialized OPAMP1 as PGA with just a positive input and simply called the HAL function for calibration.

Sadly the results aren't very satisfying. The calibration routine always ends up to drive the output to a negative offset. Pretty much all analog input voltages end up being "sucked" to ground and only high input voltages to begin with are passed through... (so e.g. everything till 100mV reads as "zero" at the OPAMP output, although the gain is set to 16)

So far I had to tweak the trimming registers myself in order to achieve useful results. Did anyone have similar experiences?

/* OPAMP1 GPIO Configuration
 * PA0     ------> OPAMP1_VINP
 * PA3     ------> OPAMP1_VOUT
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_3;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Peripheral OPAMP_MOTOR init */
hopamp_imotor.Instance = OPAMP_IMOTOR;
hopamp_imotor.Init.PowerSupplyRange = OPAMP_POWERSUPPLY_HIGH;
hopamp_imotor.Init.Mode = OPAMP_PGA_MODE;
hopamp_imotor.Init.NonInvertingInput = OPAMP_NONINVERTINGINPUT_IO0;
hopamp_imotor.Init.InvertingInput = OPAMP_INVERTINGINPUT_CONNECT_NO;
hopamp_imotor.Init.PgaGain = OPAMP_PGA_GAIN_16;
hopamp_imotor.Init.PowerMode = OPAMP_POWERMODE_NORMAL;
hopamp_imotor.Init.UserTrimming = OPAMP_TRIMMING_USER;
if(HAL_OPAMP_Init(&hopamp_imotor) != HAL_OK)
    return HAL_ERROR;
/* Run calibration routine */