cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L152 Blink LED does not work....

jaspervandenakker
Associate II
Posted on November 06, 2015 at 21:43

Hi all,

For 3 years ago, I've used a Discovery L1 board and used the drivers in the Discovery Firmware package. I have developed a nice automatic chicken coop door. It is calculating Sunrise, Sunset and close/open the door on these times. Now, I have to create a same system for a friend of mine, and bought a Nucleo board. It has the same processor, so I thought it would be easy to change some GPIO pins, and GO. But that was not so easy. Even a blinky LED is not possible. The LED goes on, but never goes OFF. I have used the GPIO_HIGH, GPIO_LOW or GPIO_TOGGLE, but the LED never goes off. I've tried the Pull up/down/nopull options..... I have removed the Solder bridges: SB16, SB50, SB The Model of the Nucleo is MB1136 C-03 Below my RCC config. Maybe somebody see why it is not working. Many thanks in advance.

void RCC_Configuration(void){ 
/* Enable HSI Clock */
RCC_HSICmd(ENABLE);
/*!< Wait till HSI is ready */
while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
/* Set HSI as sys clock*/
RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);
/* Enable the GPIOs clocks */
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA | RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC| RCC_AHBPeriph_GPIOD| RCC_AHBPeriph_GPIOE| RCC_AHBPeriph_GPIOH, ENABLE); 
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Allow access to the RTC */
PWR_RTCAccessCmd(ENABLE);
/* Reset RTC Backup Domain */
RCC_RTCResetCmd(ENABLE);
RCC_RTCResetCmd(DISABLE);
/* LSE Enable, 786 kHz rtc*/
RCC_LSEConfig(RCC_LSE_ON);
/* Wait until LSE is ready */
while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);
/* RTC Clock Source Selection */ 
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); 
/* Enable the RTC */
RCC_RTCCLKCmd(ENABLE); 
/*Disable HSE*/
RCC_HSEConfig(RCC_HSE_OFF);
if(RCC_GetFlagStatus(RCC_FLAG_HSERDY) != RESET ){
/* Stay in infinite loop if HSE is not disabled*/
while(1); 
}
}

2 REPLIES 2
Posted on November 06, 2015 at 22:10

So have you stepped through this code, and is it failing or locking? How does it relate to the LED flashing?

Does the board have an LSE mounted?

The HSE would come by way of the 8 MHz output by the ST-LINK's STM32, and you'd want that in BYPASS mode if you want to use it.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
jaspervandenakker
Associate II
Posted on November 06, 2015 at 22:16

Hi clive1,

Thank you for your reply. No, I did not step through this code with this board but I previously did with the discovery board, I can't step through at the moment (on OSX now and no debugger). But the strange thing is that when I use the following code:

GPIO_LOW(GPIOA, 5);
Delay(10000);
GPIO_HIGH(GPIOA, 5);

Delay(10000);

The LED goes ON after a few seconds. and never goes OFF When I change this in first ON and then OFF, it is ON immediately. So it seems that the LED wil NEVER switch OFF.... This is my GPIO INIT:

GPIO_InitStructure.GPIO_Pin = 5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);