2025-03-20 6:28 AM
Hi,I am using an STM32L476 on Nucleo64 board, I am amplifying a 1MHz 200mVpp sine wave with a 100mV offset in order to try the OPAMP but I dont think it is working.
I configured OPAMP in PGA not connected mode(Also tried PGA connected too) and gave it to the same channel with my dual ADCs in order to read it from ADC. Before that I wanted to be sure that the amplified signal is correct but it is not.
My Opamp configurations:
static void MX_OPAMP2_Init(void)
{
/* USER CODE BEGIN OPAMP2_Init 0 */
/* USER CODE END OPAMP2_Init 0 */
/* USER CODE BEGIN OPAMP2_Init 1 */
/* USER CODE END OPAMP2_Init 1 */
hopamp2.Instance = OPAMP2;
hopamp2.Init.PowerSupplyRange = OPAMP_POWERSUPPLY_LOW;
hopamp2.Init.Mode = OPAMP_PGA_MODE;
hopamp2.Init.NonInvertingInput = OPAMP_NONINVERTINGINPUT_IO0;
hopamp2.Init.InvertingInput = OPAMP_INVERTINGINPUT_CONNECT_NO;
hopamp2.Init.PgaGain = OPAMP_PGA_GAIN_4;
hopamp2.Init.PowerMode = OPAMP_POWERMODE_NORMALPOWER;
hopamp2.Init.UserTrimming = OPAMP_TRIMMING_USER;
hopamp2.Init.TrimmingValueP = 0;
hopamp2.Init.TrimmingValueN = 0;
if (HAL_OPAMP_Init(&hopamp2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN OPAMP2_Init 2 */
/* USER CODE END OPAMP2_Init 2 */
}
I gave my sine wave to PA6 and reading the output signal(Which is also the signal going to ADCs) from PB0. This is the output I get:
Yellow one is the input signal and green one is the output signal. It is reduced, offsetted and shifted. This is with gain 2. When I make gain 4 the signal just offsets more. I read the application note and datasheet too but could not figure out what am I doing wrong, I also started the OPAMP using HAL_OPAMP_START.
Solved! Go to Solution.
2025-03-20 6:44 AM
I figured that it the amplfying performance reduces as the frequency goes up so It is insufficient for high frequency signals, It is not working properly when the signal is higher than 400kHz, even with that it has an offset and phase shift so it is not usable after 50kHz in my experience.
I am not sure if there is any other internal mechanisms to increase its performance.
2025-03-20 6:44 AM
I figured that it the amplfying performance reduces as the frequency goes up so It is insufficient for high frequency signals, It is not working properly when the signal is higher than 400kHz, even with that it has an offset and phase shift so it is not usable after 50kHz in my experience.
I am not sure if there is any other internal mechanisms to increase its performance.