cancel
Showing results for 
Search instead for 
Did you mean: 

Stm32f3 operational amplifier

arganasss
Associate II
Posted on March 25, 2014 at 21:49

Hello, i want to ask something about embedded operational amplifiers in stm32f3. Even when my application is not running, i am feeding an external signal to the op amp through I/O pin. When i start my program, i see with oscilloscope that output of op amp is trembling for some time. Here is my op amp configuration. 

void OPAMP_configuration(void)

{

  // PA2 as opamp1 output

  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;

  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; // Analog mode

  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

  GPIO_Init(GPIOA, &GPIO_InitStructure);

  OPAMP_InitStructure.OPAMP_NonInvertingInput = OPAMP_NonInvertingInput_IO2;

  OPAMP_InitStructure.OPAMP_InvertingInput =  OPAMP_InvertingInput_IO2;

  OPAMP_Init(OPAMP_Selection_OPAMP1, &OPAMP_InitStructure);

  OPAMP_Cmd(OPAMP_Selection_OPAMP1, ENABLE);

}

Now i can see in datasheet, electrical characteristics chapter, that during calibration, minimum time needed between too steps to have 1mV accuracy is 2ms. As you can see, i am not during calibration procedure at all, and my external signal which is connected to the op amp has a period of 500us. So i want to ask, do i need to use this function 

void OPAMP_StartCalibration(uint32_t OPAMP_Selection, FunctionalState NewState)

and whait for those 2ms doing nothing, in order to configure op amp and to get him working properly? Could this have some influence later on, on my application? Or this doesn't have any influence at all? What that calibration function does, because i didn't find this explained. Or that trembling that i am seeing with oscilloscope is unrelated to his calibration procedure? Thanks a lot in advance for your answers.
3 REPLIES 3
Amel NASRI
ST Employee
Posted on March 26, 2014 at 10:56

Both output & input pins have to be configured in analog mode, also clocks have to be enabled:

void OPAMP_Config(void) 
{ 
GPIO_InitTypeDef GPIO_InitStructure; 
OPAMP_InitTypeDef OPAMP_InitStructure; 
/* GPIOA Peripheral clock enable */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA, ENABLE); 
/* Configure PA2, PA3, PA5 in analog mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_
2
| GPIO_Pin_
3
| GPIO_Pin_
5
; 
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; 
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL ; 
GPIO_Init(GPIOA, &GPIO_InitStructure); 
/* Enable SYSCFG clock */
RCC_APB
2
PeriphClockCmd(RCC_APB
2
Periph_SYSCFG, ENABLE); 
/* Select inverting input connected to IO2 (PA3) and non inverting input IO2 (PA5) */
OPAMP_InitStructure.OPAMP_InvertingInput = OPAMP_InvertingInput_IO
2
; 
OPAMP_InitStructure.OPAMP_NonInvertingInput = OPAMP_NonInvertingInput_IO
2
; 
OPAMP_Init(OPAMP_Selection_OPAMP
1
, &OPAMP_InitStructure); 
/* Enable OPAMP1 */
OPAMP_Cmd(OPAMP_Selection_OPAMP
1
, ENABLE); 
}

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

arganasss
Associate II
Posted on March 26, 2014 at 11:16

Thanks Mayla, but i know this. i did the other configuration in my GPIO_configure function. Also, i have enabled clocks for op amp. I know that because it is working 🙂 I'm just wondering about that calibration function and how to use that. And im asking if the trembling of the signal which i see could be related to this, that i don't do any calibration. Thanks.

arganasss
Associate II
Posted on March 28, 2014 at 14:16

Hey everyone, im still looking answer to my question. And still don't understand that calibration procedure, so if someone could help, i would be grateful.