2020-03-21 10:41 AM
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.
Solved! Go to Solution.
2020-03-30 12:41 PM
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.
2020-03-21 12:38 PM
I have this problem only in my stm8s003f3p6 ,in stm8s105k4 its ok.
2020-03-21 12:50 PM
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)
{
}
}
2020-03-21 12:50 PM
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)
{
}
}
2020-03-30 12:41 PM
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.