Skip to main content
Visitor II
March 21, 2020
Solved

GPIOB not working in my stm8s003

  • March 21, 2020
  • 4 replies
  • 1551 views

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.

    This topic has been closed for replies.
    Best answer by Cristian Gyorgy

    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.

    4 replies

    Visitor II
    March 21, 2020

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

    Visitor II
    March 21, 2020

    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)

     {

      

     }

      

    }

    Visitor II
    March 21, 2020

    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)

     {

      

     }

      

    }

    Visitor II
    March 30, 2020

    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.