Page 1 of 1
How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Sun Feb 16, 2025 9:46 am
by brmmm3
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?
Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Mon Feb 17, 2025 7:36 am
by MicroController
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)?
Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Fri Apr 18, 2025 4:14 pm
by eriksl
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.
Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Fri Apr 18, 2025 6:19 pm
by mbratch
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?
Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Sat Apr 19, 2025 6:56 am
by eriksl
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.
Re: How to communicate with I2C devices with 2 addresses with the new I2C master driver
Posted: Sun Apr 20, 2025 1:30 am
by mbratch
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.