cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L Discovery Blue/Green Led not working

lawi
Associate
Posted on March 19, 2013 at 02:13

Hi,

I managed to compile and start the Temperature Measurement Example with Eclipse and Code Sorcery. It runs and shows a temperature.

I wanted to add a few lines of code to see the LEDs blinking inside the infinite while loop of the example. 

So I started to GPIO_Set the Bits with  GPIO_SetBits(GPIOB, GPIO_Pin_6|GPIO_Pin_7);

Seems to be strait forward, but nothing happens. The Pins stay Low all time (measured).

The main.c is containing a Init_GPIOs.

With this Lines:

    GPIO_InitStructure.GPIO_Pin = LD_GREEN_GPIO_PIN | LD_BLUE_GPIO_PIN;

    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

    GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

    GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;

    GPIO_Init(GPIOB, &GPIO_InitStructure);

I only used sources from STM32L_Discovery_Firmware_Pack_V1.0.2.

I see that the SetBits call ends up in GPIOx->BSRRL = GPIO_Pin;

I also toggled the Bits using also the ResetBis function, with no success.

Maybe the registers are not mapped correctly.

Where is the translation to an address for GPIOx->BSRRL = GPIO_Pin; ?

Had someone else a Problem with Leds in the Temperature example?

Have anybody experience using Eclipse/Code Sorcery/OpenOCD?

Thanks.

Michael

#bit-banding-stm32l #gpio #led
1 REPLY 1
frankmeyer9
Associate II
Posted on March 19, 2013 at 08:38

Have you turned on the clock for the GPIOB ?

If not, all your initialization and access attempts are futile.

I suggest to take an example, GPIOToggle for instance, from the peripheral libs, and dissect it.

It will show you all the steps necessary to use GPIO pins.