cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151CB OSC32 GPIO PC14 PC15 usage

pablovivan
Associate II
Posted on June 23, 2012 at 13:47

Hello to everybody,

I am trying everything to be able to use the PC14 and PC15 pins as digital outputs, but I can't get it at all. 

Obviously I'm not using the LSE.

Both pins aer conected  to two MOSFET gates respectively, so there is barely power consum (I'm not trying to drive a LED or anything like that)

The information found in the documentation is very, very poor and in the forums isn't more useful.

I have assumed that the LSE is off once I turn on the uC and just defining the pins as outputs and using the GPIO_SetBits doesn't work.

I have assumed that the LSE is on once I turn on the uC. I inicialized APB1_PWR clock. I enabled the RTC access and I disabled the LSE clock security system and I turned off the LSE explicitly.

I think I've tried all the likely combinations and I keep on failing. I`m missing something but I dont realize what is it. I hope you could help me. Thanks in advance.

Regrads.

#stm32l-osc32-gpio-pc14-pc15 #pc13-pc14-pc15-gpio
7 REPLIES 7
Posted on June 23, 2012 at 14:56

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
// GPIO Function lost in STANDBY, PC14,PC15 revert to analog inputs
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14 | GPIO_Pin_14;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOC, &GPIO_InitStructure);
PWR_RTCAccessCmd(ENABLE); // Enable access to LSE
RCC_LSEConfig(RCC_LSE_OFF); // PC14 PC15 as GPIO

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
pablovivan
Associate II
Posted on June 25, 2012 at 10:59

Hello Clive,

thank you for answering. I have already configured it in that form, only with the difference of the speed, I did it with 2MHz. Could it be a problem? It keeps on failing.

Regards

ac
Associate II
Posted on March 13, 2014 at 15:32

We are seeing a similar issue, we can't configure PC14 as an output, was this resolved?

Posted on March 13, 2014 at 16:42

We are seeing a similar issue, we can't configure PC14 as an output, was this resolved?

On an L1 part or something else?

For the L1 you HAVE to turn the LSE off to take control of the pin.

 

 

''The PC14 and PC15 I/Os are only configured as OSC32_IN/OSC32_OUT when the LSE oscillator is on (by setting the LSEON bit in the RCC_CSR register). The LSE oscillator pins OSC32_IN/OSC32_OUT can be used as general-purpose PC14/PC15 I/Os, respectively, when the LSE oscillator is off ( after reset, the LSE oscillator is off ). The LSE has priority over the GPIO function. For more details, refer to Using the OSC32_IN/OSC32_OUT pins as GPIO PC14/PC15 port pins section in the STM32L15xxx reference manual (RM0038).''

For the F1/F2/F4 these pins are in the BACKUP domain, and have lower current (sink/source) specs.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ac
Associate II
Posted on March 13, 2014 at 16:52

STM32F100C8, LSE is off.

Posted on March 13, 2014 at 16:56

STM32F100C8, LSE is off.

Would seem a new thread would have been appropriate, with a clear code example about how you're configuring the pin now, and what it's connected too in your board design.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ac
Associate II
Posted on March 14, 2014 at 19:19

We found the problem was that the GPIOC clock was not enabled before we wrote to the GPIOC port configuration registers.