cancel
Showing results for 
Search instead for 
Did you mean: 

Not Able to drive GPIO pin on STM8L Discovery board

sachin2
Associate
Posted on July 31, 2014 at 12:54

Hi ,

I am not able to see any voltage changes on GPIO pins of stm8l discovery.

I have written the code, its compiling properly and i also could see the ODR register changing its value .

I am using STVD and cosmic compiler

/* MAIN.C file

 * 

 * Copyright (c) 2002-2005 STMicroelectronics

 */

#include ''stm8l15x.h''

void delay_s(void);

main()

{

CLK_HSICmd(ENABLE);

GPIO_DeInit(GPIOD);

GPIO_Init(GPIOD,GPIO_Pin_4,GPIO_Mode_Out_OD_Low_Fast);

while(1)

{

GPIO_WriteBit(GPIOD,GPIO_Pin_4,SET);

delay_s();

GPIO_WriteBit(GPIOD,GPIO_Pin_4,RESET);

}

}

void delay_s()

{

uint8_t i,j;

for(j=0;j<150;j++);

}

Thanks ,

Sachin.
1 REPLY 1
balmukund66
Associate II
Posted on August 29, 2014 at 06:08

Hello ,

Please initilaize the pin in Push Pull Mode,Not Output drain mode.

or

In your configuration ,Please add pull up resistor on that pin.

It will work in either case.

Thanks & Regards,

Balmukund Prasad