How to communicate with I2C devices with 2 addresses with the new I2C master driver

brmmm3
Posts: 1
Joined: Sun Feb 16, 2025 9:41 am

How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby brmmm3 » Sun Feb 16, 2025 9:46 am

Please, can someone post an example code how for setup and communication with I2C devices which have 2 addresses (one for read and one for write) with the new I2C master driver?

MicroController
Posts: 2694
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby MicroController » Mon Feb 17, 2025 7:36 am

I2C devices which have 2 addresses (one for read and one for write)
Sounds odd. Are you sure that's two addresses and not a single address + R/W bit?
Do you have an example of such a device (datasheet)?

eriksl
Posts: 199
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby eriksl » Fri Apr 18, 2025 4:14 pm

From memory the VEML6040 does this. Very odd. Something like one address for register access and one address for data access. Totaly against the spirit of I2C. I'd recommend staying away from these devices.

Having said that, it's probably possible to add them as two separate slaves.

User avatar
mbratch
Posts: 317
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby mbratch » Fri Apr 18, 2025 6:19 pm

When I looked at the VEML6040 data sheet, it just indicates one slave address 0x10.

What data sheet are you looking at that indicates two different addresses?

eriksl
Posts: 199
Joined: Thu Dec 14, 2023 3:23 pm
Location: Netherlands

Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby eriksl » Sat Apr 19, 2025 6:56 am

Yes, I mixed up, sorry. The VEML6040 is okay, it's the VEML6070 that's troublesome.
Slave Address and Function Description
The VEML6070 has one slave address used for write functions (command) and two slave addresses used for read functions
(UV data LSB and MSB).
The 7-bit address for write functions is 38h = 0111000x resulting in a 70h = 01110000 8-bit address. The 7-bit addresses
for read functions are 38h = 0111000x for the UV Data LSB and 39h = 0111001x for the UV data MSB. This results in a
71h = 01110001 and 73h = 01110011 8-bit address, respectively. The 7-bit address 39h should not be used for a write function.
https://cdn-shop.adafruit.com/product-f ... ml6070.pdf

BTW I have found another one: TSL2591. It listens to two addresses, which it responds to equally.

User avatar
mbratch
Posts: 317
Joined: Fri Jun 11, 2021 1:51 pm

Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver

Postby mbratch » Sun Apr 20, 2025 1:30 am

I think the idea of adding the same device as two different slaves may be the way to go, just treating the two different addresses as if they are for two different chips. That's what I would try anyway.

Who is online

Users browsing this forum: Amazon [Bot], Bing [Bot], Qwantbot and 3 guests