2023-07-12 11:39 PM
In the comment to the functions it says (stm32f4xx_hal_smbus.c)
* @PAram DevAddress Target device address The device 7 bits address value
* in datasheet must be shifted to the left before calling the interface
I suspect this was copy & pasted from the I2C driver. When not shifting the address the driver works.
2023-07-13 12:23 AM
For the ST HAL I2C drivers, the address should not be shifted. The R/W flag in LSB is OR'ed.
Maybe this comment relates to device data sheets that follow the Linux i2c convention.
2023-07-13 06:06 AM
Hi,
Thanks! Then it would be nice to elaborate in that comment please. It took me quite some time until I by accident forgot to shift the address (as supplied in Texas Instruments Datasheet) and suddenly it worked 🙂
2023-07-31 11:59 PM
Dear,
This message is correct in the driver. No issue copy/paste.
In fact this message have been added as some "old" I2C slave document shared the address of their device in real 7bits definition. So it will be necessary to shift it to the left to put it in 8bits word.
Now, if your device already declare the address in 8bits in its appropriate datasheet, no need to shift it. Our recommendation is only for datasheet which share the device address in real 7bits.
HAL driver not support the internal shifting, to prevent the disparity of the datasheet owner definition of the I2C address.
Hope that clear now
Regards
2023-08-07 12:17 PM
For the ST HAL I2C drivers, the address should not be shifted. The R/W flag in LSB is OR'ed.
Which means exactly the opposite - the address should be shifted left by 1 bit. I2C addresses are 7-bit, not 8-bit in size. 😉