cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S003F3 chip and GPIO

comet_artificial
Associate II
Posted on August 15, 2012 at 04:33

Hi all!

I'm working with STM8S003F3 chip on my project and I'm have some problem about it,

i wana help of ST technician. on my project,i using pin4 and pin5 of port B to control normal IO applications,I have already used sample code of ST's library about GPIO in stm8s_gpio.c file, i have already written code following:

int main(void){

GPIO_DeInit(GPIOB);  GPIO_Init(GPIOB,GPIO_PIN_4,GPIO_MODE_OUT_PP_LOW_FAST);

  while(1){

  GPIO_WriteHigh(GPIOB,GPIO_PIN_4);

  };

}

but it not run. the voltage of this pin ~1.85V when it high and = 0.00V when it low

I have already used this code to control all of other pin of other port,it run fine. I have already used this code too to control pin4 and pin5 of portB of STM8S105C6T6 chip on stm8s-discovery board,it run fine.

May be it have some special thing about these pins??

Please help me answer it.

thanks and best regard!

Vui Nguyen.
2 REPLIES 2
fggnrc2
Associate II
Posted on August 15, 2012 at 07:03

Hello.

PB4 and PB5 are true open drain outputs.

This means that no pull-up resistor is internally attached to them.

When you drive them high, they will be in the floating state.

So there is nothing wrong with your code, all you need to make them work is to add two pull-up resistors.

Regards

EtaPhi

comet_artificial
Associate II
Posted on August 16, 2012 at 03:23

Hi,

Thanks so much,it have already run fine.

BR!