Skip to main content
HKPhysicist
Associate
July 13, 2023
Solved

How do I handle 8 bit I2C address when I port ST32 driver to 8 bit device driver?

  • July 13, 2023
  • 3 replies
  • 4522 views

Dear ST Engineers,
I am planning to port this device driver to another 8 bit MCU:
https://www.st.com/en/embedded-software/stsw-img023.html

My 8 bit MCU has I2C slave address range from 0x00 to 0x7F.

However, hint of that ST driver code insists on using uint16_t as I2C address, for example,

 

typedef struct
{
	/* To be filled with customer's platform. At least an I2C address/descriptor
	 * needs to be added */
	/* Example for most standard platform : I2C address of sensor */
 uint16_t address;
} VL53L5CX_Platform;

 

How do I reconcile this conflict?  Or do I misunderstand something about ARM 32 bit architect?

Please give your valuable opinions.  :cowboy_hat_face:

This topic has been closed for replies.
Best answer by HKPhysicist

Porting 32 bit driver to 8 bit driver is not trivial.

I accomplished it by porting it to another 32 bit MCU.

3 replies

xisco
Senior
July 13, 2023

Making a 1 bit right displacement.

If your address for STM32 is

xxxxxxx0

The address for others will be

0xxxxxxx

 

Tesla DeLorean
Guru
July 13, 2023

I2C has a 7-bit and 10-bit addressing mode, the register is large enough to accommodate either.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
HKPhysicist
HKPhysicistAuthorBest answer
Associate
July 14, 2023

Porting 32 bit driver to 8 bit driver is not trivial.

I accomplished it by porting it to another 32 bit MCU.