cancel
Showing results for 
Search instead for 
Did you mean: 

OPAMP1 in STM32L151 how to turn on ?

Mikhail Polyakov
Associate II
Posted on January 17, 2013 at 06:15

Hello  everybody !

How to turn on OPAMP1 in STM32L151 ?

Under debug (I use Keil + Ulink)   I see the content of OPAMP_CSR register.  All bits are 0 after the reset of the processor.  But according to datasheet, after reset some bits must be 1.

When I try to set any bit to 1 , it stay at 0.

OPAMP1 behaves as if this peripheral is switched off or clocking of this peripheral is switched off.  But there is no bits related to OPAMP in RCC.

What am i do wrong ?  How to turn on  OPAMP1 ?

#opamp-opamp1-stm32l151-turn-on
3 REPLIES 3
lowpowermcu
Associate II
Posted on January 17, 2013 at 09:15

Hi

Just look at the header of opamp.c driver the steps are described there:

 (#) COMP AHB clock must be enabled to get write access

       to OPAMP registers using

       RCC_APB1PeriphClockCmd(RCC_APB1Periph_COMP, ENABLE)

  

 (#) Configure the corresponding GPIO to OPAMPx INP, OPAMPx_INN (if used)

       and OPAMPx_OUT in analog mode.

   

(#) Configure (close/open) the OPAMP switches using OPAMP_SwitchCmd()

(#) Enable the OPAMP peripheral using OPAMP_Cmd()

MCU Lüfter

 

Mikhail Polyakov
Associate II
Posted on January 17, 2013 at 10:30

Thank You  for answer.

I do not use any libraries, I write all registers myself.

So I have no file  opamp.c  If You have it, please post it here, i Will look.

Accordance with Your recomendations I have turn on COMP AHB clock,

but behavior of  OPAMP CSR registor did  not change. In datasheet I can not find anything about switching on COMP AHB clock  before use OPAMP.  

lowpowermcu
Associate II
Posted on January 17, 2013 at 10:41

Hi,

You find it here

http://www.st.com/internet/com/SOFTWARE_RESOURCES/SW_COMPONENT/FIRMWARE/stm32l1_stdperiph_lib.zip

with examples on OPAMPs in

STM32L1xx_StdPeriph_Lib_V1.1.1\Project\STM32L1xx_StdPeriph_Examples\OPAMP\

 

and opamp.c in

STM32L1xx_StdPeriph_Lib_V1.1.1\Libraries\STM32L1xx_StdPeriph_Driver\src\

In datasheet I can not find anything about switching on COMP AHB clock  before use OPAMP.  

 

>> You should look in the reference manual available here:

http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/REFERENCE_MANUAL/CD00240193.pdf