2015-11-07 07:53 AM
Hello
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.Mode = GPIO_MODE_ANALOG;
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 */
HAL_OPAMP_SelfCalibrate(&hopamp_imotor);
2015-11-16 05:16 AM
/* Run calibration routine */
OpampHandle.Init.Mode = OPAMP_STANDALONE_MODE ;
if(HAL_OPAMP_Init(&OpampHandle) != HAL_OK)
return HAL_ERROR;
HAL_OPAMP_SelfCalibrate(&hopamp_imotor);
OpampHandle.Init.Mode = OPAMP_PGA_MODE;
if(HAL_OPAMP_Init(&OpampHandle) != HAL_OK)
return HAL_ERROR;
Regards.
2015-11-17 12:20 AM
Hello, Vinci.
I did some TYPO in code, I corrected. Regards.2015-11-17 12:32 AM
Hello, Vinci.
Sorry, I had difficulty of this web interface. I did TYPO in handler name, please use the original one. &hopamp_imotor
Regards.2015-11-17 02:00 AM
Haha I guess I'd have figured that one out one my own. :)
But thank you very much for the suggestion with changing the opamp mode. I still have to finetune a little myself, but the initial guess from the calibration routine is way better.