2013-01-16 09:15 PM
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-on2013-01-17 12:15 AM
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
2013-01-17 01:30 AM
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.2013-01-17 01:41 AM
Hi,
You find it herehttp://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: