cancel
Showing results for 
Search instead for 
Did you mean: 

GPIOB not working in my stm8s003

Arman Ilmak
Senior

Hey guys.

Im using stm8s003f3p6 and IAR compiler and ST SPL.

When i use gpio_init to make pb4 and pb5 output i dont know why the output does not get high and low?

Other pins on port c ,a and etc work well.

1 ACCEPTED SOLUTION

Accepted Solutions
Cristian Gyorgy
Senior III

PB4 & PB5 are true open drain ports, for I2C bus, on STM8S003. Push-pull is not available on them (see the datasheet).

If you want a high level to be output on the port, you will need a pull-up.

View solution in original post

4 REPLIES 4
Arman Ilmak
Senior

I have this problem only in my stm8s003f3p6 ,in stm8s105k4 its ok.

Arman Ilmak
Senior

void main(void)

{

  

  GPIO_Init(IR_PORT,IR_PIN ,GPIO_MODE_IN_FL_IT);

  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOC, EXTI_SENSITIVITY_FALL_ONLY);

  enableInterrupts();

  

  CLK_DeInit();

  CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);

  TIM2_Config();

  GPIO_Init(LED_PORT,LED_PIN,GPIO_MODE_OUT_PP_HIGH_FAST);

 /* Infinite loop */

 while (1)

 {

  

 }

  

}

Arman Ilmak
Senior

void main(void)

{

  

  GPIO_Init(IR_PORT,IR_PIN ,GPIO_MODE_IN_FL_IT);

  EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOC, EXTI_SENSITIVITY_FALL_ONLY);

  enableInterrupts();

  

  CLK_DeInit();

  CLK_HSIPrescalerConfig(CLK_PRESCALER_HSIDIV1);

  TIM2_Config();

  GPIO_Init(LED_PORT,LED_PIN,GPIO_MODE_OUT_PP_HIGH_FAST);

 /* Infinite loop */

 while (1)

 {

  

 }

  

}

Cristian Gyorgy
Senior III

PB4 & PB5 are true open drain ports, for I2C bus, on STM8S003. Push-pull is not available on them (see the datasheet).

If you want a high level to be output on the port, you will need a pull-up.