cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L1 OPAMP1 Gain Error

Tom
Associate II
Posted on April 02, 2014 at 15:28

Hello All,

I connected DAC1 output (S6 closed, S5 opened) to the internal OPAMP1 AIN+ which is in noninvering configuration by two external resistors (Rf=150k, Rg (to ground)=50k) which should yeld G=x4 amplification. When I change DAC output (Uin) from0 - 0,5V I get on the OPAMP1 ouput (ADC Input Channel 3), Vout : Uin=0,5V -> Vout=2,035V which is ca. G=4,0 Uin=0,2V -> Vout=0,853V which is ca. G=4,2 Uin=0,1V -> Vout=0,450V which is ca. G=4,5 Uin=0,025V -> Vout=0,157V which is ca. G=6,2 !!!! The lower the Uin to the opamp AIN+ the greater the OPAMP Gain error. These are my configs:

void OPAMP1_Config(void)
{
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE);
/* (OPAMP1 output) in analog mode Configure (OPAMP1 positive input) and (OPAMP1 negative input) in analog mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* COMP Peripheral clock enable: COMP and OPAMP share the same Peripheral clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_COMP, ENABLE);
/* Enable OPAMP1 */
OPAMP_Cmd(OPAMP_Selection_OPAMP1, ENABLE);
/* Close S4 and S5 swicthes */
OPAMP_SwitchCmd(OPAMP_OPAMP1Switch4 | OPAMP_OPAMP1Switch5, ENABLE);
}

void DAC_Config(void)
{
/* Enable GPIOA clock */
/* Configure PA.04 (DAC_OUT1) in analog mode -------------------------*/
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = PinDAC1Out;
GPIO_Init(PortDAC1Out, &GPIO_InitStructure);
/* Enable DAC clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
/* DAC channel1 Configuration */
DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_None;
DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Disable; 
/* DAC Channel1 Init */
DAC_Init(DAC_Channel_1, &DAC_InitStructure);
/* Enable DAC Channel1 */
DAC_Cmd(DAC_Channel_1, ENABLE);
}

What could be the reason for this error? thanks in advance Tom #stm32l-opamp-gain-error
1 REPLY 1
Tom
Associate II
Posted on April 02, 2014 at 15:42

This is the internal schematic I use:

0690X00000602ruQAA.jpg