cancel
Showing results for 
Search instead for 
Did you mean: 

driving LD3 in STM32L1 discovery kit

Posted on October 28, 2014 at 14:19

Hello,

I am new to STM32 development. I am trying to get familiar with discovery kit.

I am using Atollic true studio lite version. I am trying to drive LD3 but it seems not working. Here is my code:

&sharpinclude <stddef.h>

&sharpinclude ''stm32l1xx.h''

static volatile uint32_t TimingDelay;

static void GPIO_LED_GREEN_SETUP(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

RCC_DeInit();

// GPIO_DeInit(GPIOB);

RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE);

GPIO_StructInit(&GPIO_InitStructure);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7;

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

GPIO_Init(GPIOB, &GPIO_InitStructure);

}

int main(void)

{

GPIO_LED_GREEN_SETUP();

GPIO_SetBits(GPIOB,GPIO_Pin_7); /* LED on/off */

while(1);

// }

return 0;

}

#stm32l152rc-discovery-kit
2 REPLIES 2
Posted on October 28, 2014 at 16:16

Have it toggle the pin in a loop, and step through it in the debugger.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on October 28, 2014 at 16:37

I changed the code something like this:

while(1)

  {

    int i = 0;

    i++;

    GPIO_ToggleBits(GPIOB, GPIO_Pin_7);

  }

It doesn't work with dicovery kit but it works with nucleo kit.