cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I would like to know how to configure I2C with MCU STM32L5. Thank you for your helps

DYann.1
Senior

I have a CODEC SGTL5000, I need to communicate by I2C but I have an error I don't know if it comes from hardware or software?

Thank you for your help

6 REPLIES 6
Foued_KH
ST Employee

Hello @DYann.1​ ,

Please refer to the wiki : Getting started with I2C - stm32mcu

Check results via an oscilloscope and Read/Write registers.

If nothings appears, please check the error flags set in the status register.

Try to get the error (HAL_I2C_GetError)

If the error is :

  • OVR, ARLO, NACK : you can just do a Transmit again
  • BERR : You have to re-enable the peripheral

If you are facing some erratic behavior on STM32, do not forget to check Errata sheet of the device. There are few points related to I2C interface. 

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

DYann.1
Senior

Hello @KHALSI_Foued,

I have now another error, it hasn't happened before :

0693W00000aHvDZQA0.pngwhat does it mean that the target is not available ? I'm stuck at this line

0693W00000aHvFuQAK.pngSomething was wrong with my SysTick ? How to check my SysTick if it's working properly ?

Thank you for your answer.

Regards

DYann.1
Senior

Hi,

Sorry now I can locate the error :

0693W00000aHvLYQA0.pngHAL_I2C return 1 as error What does that mean ?

DYann.1
Senior

Hi,

I think I gave a wrong address for the CODEC.

0693W00000aHvQEQA0.pngNormally after the DS

0693W00000aHvR7QAK.pngAfter me the Adress is 10 (dec).

Hello,

Please check results via an oscilloscope. (Maybe it can be not the correct Address)

Foued

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

DYann.1
Senior

Hi,

I've a evaluation board STM32L552E-EV and after the PCB :

0693W00000aHx2iQAC.pngI check the pin 7 and I have nothing SCL and nothing either and nothing either for the SDA pin. How it's possible ?