How to use 2 i2c channels on stm32f103c8t6 (other than pb6 & pb7) platformio framework arduino

I have 2 devices using I2C: BH1750 and LCD16x2. I used 2 pins PB6 and pB7 for BH1750 and it worked but when i use 2 pins PB8 and PB9 for LCD, it didn’t. I have been searching and don’t know how to enable multiple I2C channels on STM32F103C8T6 when using PlatformIO framework Arduino. Can someone help me plz, I am now really running out of time and patience…

Here is my entire of my platform.ini in my project:
[env:genericSTM32F103C8]

platform = ststm32

board = genericSTM32F103C8

framework = arduino

debug_tool = stlink

monitor_speed = 115200

upload_protocol = stlink

lib_deps =

claws/BH1750@^1.3.0

adafruit/DHT sensor library@^1.4.4

marcoschwartz/LiquidCrystal_I2C@^1.1.4

adafruit/Adafruit Unified Sensor@^1.1.9

bblanchon/ArduinoJson@^6.21.0

stm32duino/STM32duino FreeRTOS@^10.3.1

bblanchon/ArduinoJson@^6.21.0

khoih-prog/STM32_PWM @ ^1.0.1

khoih-prog/STM32_PWM @ 1.0.1

Unfortunately, I cannot give you an answer to your actual question.

But I have noticed that your platformio.ini contains duplicate or contradictory entries.

bblanchon/ArduinoJson@^6.21.0
bblanchon/ArduinoJson@^6.21.0
khoih-prog/STM32_PWM @ ^1.0.1
khoih-prog/STM32_PWM @ 1.0.1

Please also note that the khoi-prog/STM32_PWM repository is archived and no longer maintained (see github.com/khoih-prog/STM32_PWM).

For better readability, please use preformatted-text when posting the content of a file.

Thank you for ur reply! If you know someone or someway helpful please just let me know here

1 Like