Skip to main content
darla14
Associate III
February 10, 2021
Question

Regarding AN5203 why init/denit i2c in while loop?

  • February 10, 2021
  • 1 reply
  • 632 views

Hello,

In document : https://www.stmicroelectronics.com.cn/resource/en/application_note/dm00528962-teseoliv3f--i2c-positioning-sensor--stmicroelectronics.pdf pase 16.

is it mandatory to have below code in a while loop?

HAL_I2C_DeInit(&hi2c1);

HAL_I2C_Init(&hi2c1);

Why cant we init i2c just once?

Second question :

This set of commands will:  Reset the i2c message list  Disable the eco-ing message  Save the configuration on flash

>

$PSTMCFGMSGL,3,1,0,0 $PSTMSETPAR,1227,1,2 $PSTMSAVEPAR

Can you please tell the similiar code being used in the GetPos_I2C example for L476RG where we are using this commandset to enable i2c?

Third and last question :

If we have to use the uart again(between STM32 and Teseo) , what command set to be sent ?

Br,

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    February 10, 2021

    The deint/init does seem unnecessary, the bus typically doesn't need resetting unless you have an error. In many cases it might not help because the devices lack an asynchronous reset.

    The trick here is to perhaps actually try things, and experiment.

    Perhaps find someone in the local sales office, or engineering support, who can provide you with assistance and/or direction.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..