Showing results for 
Search instead for 
Did you mean: 

I2C example`

Associate III


I want to implement I2C communication.

1 master and 3 slave, which transmit and recieve in both direction.


Is there any common example of it?

plz recommand website or documentation to study.


I ask GPT4 several times but I'm not sure 🙂


Thank you.


I suggest you to look at HAL library, if you want to use a C library to transmit/receive with I2c

HAL_I2C_Master_Transmit() and HAL_I2C_Master_Receive() documentation should help you

Pavel A.
Evangelist III

@eunni Just out of curiosity, the GPT produced anything reasonable? have you tried to build it?

From what I saw, If you give a concrete context and you don' ask for a lot of code, even GPT 3.5 (which is free) can produce some usable code.

You can try for free on their website, its quite fun

Yes, tried to ask it already to write something for stm32. Quite fun, yeah. Especially when you ask it to explain and it explains ))

Yes It helped a lot especially debugging process.

It tells various possible cases I'v never expected before.

It's not perfect but helpful 🙂