cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 i2c vs LSM303DLHC i2c

ACht.1
Associate
  1. Trying to match STM32F4 with LSM303DLHC and I cannot find for i2c addressing mode of type: Master: | ST | SAD + W | SAK | SUB | SAK | SR | SAD + R | SAK | ... any match in the STN32F4 7 or 10 bit addressing modes. I suppose using all those bits it is possible to assemble required protocol. But, is it the right way to do it?
  2. STM32F4 i2c "10-bit addressing mode", how does it get to this mode? Is it due to the special structure of the "header" written in place of the address? Should then this structure be excluded from the 7 bit addresses?

I hope someone can clarify for me these details. Thanks.

3 REPLIES 3
AScha.3
Chief II
  1. in HAL lib is "HAL_I2C_Mem_Read(I2C2 .. ); to read register ;
  2. in Cube/HAL just set mode : -> 10bit

0693W00000aH8hfQAC.png

If you feel a post has answered your question, please click "Accept as Solution".

You don't need 10-bit addressing for LSM303DLHC, it has a 7-bit address.

SUB in those figures mean a number which determines, which register are you going to read or write. There's no support for this "subaddress" in the I2C hardware in 'F4 (or any other STM32 AFAIK) - you simply treat it as one byte of data.

As AScha3 said above, Cube/HAL (i.e. the library) may have software support for such "subaddress" ("register address") - I don't use Cube.

JW

ACht.1
Associate

Thank you everyone for help.

I suspected that SUB just a part of data packet. Just that 'Repeat Start' a bit confusing, looking like it is a part of i2c specification. I wanted to see general picture applicable to future projects.