STM32F4 i2c vs LSM303DLHC i2c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-17 10:09 PM
- 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?
- 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.
- Labels:
-
I2C
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-17 11:33 PM
- in HAL lib is "HAL_I2C_Mem_Read(I2C2 .. ); to read register ;
- in Cube/HAL just set mode : -> 10bit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-18 12:15 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-02-18 12:00 PM
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.
