I2C communication does not work.

Post here all questions related to LibMaple core if you can't find a relevant section!
Post Reply
myksj1105
Posts: 54
Joined: Sun Jun 18, 2023 11:35 am

I2C communication does not work.

Post by myksj1105 »

MCU : STM32F103C8T6

[CORE]
- CORE : https://github.com/rogerclarkmelbourne/Arduino_STM32
- BOOT : https://github.com/rogerclarkmelbourne/ ... bootloader
- FILE : generic_boot20_pc13

[SOFTWARE-I2C]
https://github.com/rogerclarkmelbourne/ ... ftwire.ino

[HARDWARE-I2C]
https://github.com/rogerclarkmelbourne/ ... r_wire.ino

[CIRCUIT]
5V(BOARD) ------ CM1107 5V
GND(BOARD) ------ CM1107 GND
PB8(BOARD) ----- CM1107 SCL
PB9(BORAD) ----- CM1107 SDA
GND ---- CM1107 R/T(I2C MODE)

CM1107 DATASHEET : https://en.gassensor.com.cn/Product_fil ... cation.pdf

I2C communication does not work.

Why? help me.
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: I2C communication does not work.

Post by ag123 »

that device has uart
https://en.gassensor.com.cn/Product_fil ... cation.pdf
have you tried that?
uart just take different pins and is normally accessible at Serial1, Serial2 etc.
myksj1105
Posts: 54
Joined: Sun Jun 18, 2023 11:35 am

Re: I2C communication does not work.

Post by myksj1105 »

@ag123

Thank you for your interest.


1. It works well via Serial (UART).
2. The 'CM1107' board is capable of UART communication and I2C communication.
- If 'CM1107 R/T' is 0VDC, it operates through I2C.
3. It does not work when communicating via I2C.
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: I2C communication does not work.

Post by ag123 »

I2C requires a 'different skillset' vs playing with uart, uart is point to point, it is only 2 devices a sender and the other a receiver and vice versa.
but of course it is up to one to make things complicated by adding RS485, RS422 etc, but that is off-topic.

Then that for i2c, many devices share the same bus and devices are identified by addresses.

one of those things to try is to try the i2c scanner
https://github.com/rogerclarkmelbourne/ ... r_wire.ino
this should be in your core that you downloaded and installed.

i2c 'scanner' uses some aspects of i2c e.g. ack etc to detect that a device exist at that address.
That is one thing to try if you are not sure what is the address of your device.

once you are sure of the address, you can then try to send some other commands to the address to see if that responds.
other things to check are things like the voltage e.g. is that 3.3v?
and that i2c bus normally requires a pullup if I remember correctly, e.g. a 1 k resistor from that line (data) (and clock separately) to vdd (3.3v)
https://learn.adafruit.com/working-with ... -resistors
pull up to 3.3v vs pull up to 5v can have implications, stm32 are 3.3v devices.
Post Reply

Return to “General discussion”