Skip to main content
Associate III
Question

I2C example`

Hi,

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.

    This topic has been closed for replies.

    5 replies

    Associate III

    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.

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

    Associate III

    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

    Pavel A.

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