cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, how can I write start,stop,address and write functions for I2C Master Mode in stm32g031k8

Ocebe.1
Associate III
 
1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

The hardware functionality and I2C state machine is described in a reference manual. Take a note that I2C is not the simplest peripheral to program. If you lack the experience, I suggest first implementing a reliable full-duplex UART driver. That is also more practical as UART can provide additional printf() style debugging. When you will have done that, you will have gained enough experience to go on and implement I2C driver. :)

View solution in original post

5 REPLIES 5
Imen.D
ST Employee

Hello @Ocebe.1​ ,

Have a look at the I2C examples within STM32CubeG0 MCU package, which can help you as an implementation example:

\STM32Cube_FW_G0_V1.4.1\Projects\NUCLEO-G031K8\Examples\I2C\

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thank you, I will look.

I looked these examples but it used HAL Library and I don't want to use HAL , but thank you your response

Piranha
Chief II

The hardware functionality and I2C state machine is described in a reference manual. Take a note that I2C is not the simplest peripheral to program. If you lack the experience, I suggest first implementing a reliable full-duplex UART driver. That is also more practical as UART can provide additional printf() style debugging. When you will have done that, you will have gained enough experience to go on and implement I2C driver. :)

Thank you for your advice , I wrote a code for printf() :grinning_face: