Skip to main content
Graduate
December 6, 2025
Question

STM8s003F3_I2c not working

  • December 6, 2025
  • 1 reply
  • 57 views

Hey,

i didnot find any AFR4 in option byte to set PB4-SCL and PB5-SDA of STM8s003F3. Can st will help how to enable it for I2c hardware peripheral.?

    This topic has been closed for replies.

    1 reply

    Visitor II
    December 6, 2025

    You don't need to configure any AFR bit to use I2C peripheral. Configure I2C peripheral and PB4 will be SCL and PB5 will be SDA.

     

    BAS-BLEUAuthor
    Graduate
    December 7, 2025

    STM8S103 can use i2c after reset and works well, but STM8S003 can't do. i have tried all possible solution but i2c communication somehow not happening in STM8S003 MCU . can u provide simple code to test I2c in STM8s003 using EEPROM 24C32 or DS1307 RTC? pls provide working code main.c,ds1307.c/h

     

    Visitor II
    December 7, 2025

    STM8S003 is compatible with STM8S103. So the problem is in other side. Maybe option bytes OPT2/AFRx is programmed with a value different from 0. The problem can also be with the board or I2C_SDA and I2C_SCL pins.

    Do you have a pull-up resistor in I2C_SDA and I2C_SCL pins?