cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure PC0 and PC1 as ordinary pins on STM8L051F3?

Zupst
Associate

Hello! I am using STM8L051F3 with Stm8 SPL headers. I am trying to configure PC0,PC1,PC4 as output with high level:

CLK->PCKENR1 &= `CLK_PCKENR1_I2C1;
GPIOC->DDR |= (1<<0)|(1<<1)|(1<<4);
GPIOC->CR1  |= (1<<0)|(1<<1)|(1<<4);
GPIOC->ODR |= (1<<0)|(1<<1)|(1<<4);

as a result, i got high level only on PC4.

According to DS1178 Rev4 ( STM8L051f3 datasheet) p.23 PC0 and PC1 has main function as

 PORT and alternate function as I2C. I think, that somehow PC1 and PC0 acts as I2C (SDA/SDL)

 Please help me to configure PC0 and PC1 as ordinary port.

1 ACCEPTED SOLUTION

Accepted Solutions
Cristian Gyorgy
Senior III

PC0 & PC1 are true open drain ports, so if you want to measure/read a 1 value on the ports you need pull-ups.

View solution in original post

1 REPLY 1
Cristian Gyorgy
Senior III

PC0 & PC1 are true open drain ports, so if you want to measure/read a 1 value on the ports you need pull-ups.