Schorschi
Posts: 245
Joined: Thu Nov 22, 2012 9:38 pm

How does dtoverlay support for sensors handle i2c address duplicates?

Fri Aug 07, 2020 3:56 am

How does dtoverlay support for sensors handle i2c address duplicates? I say duplicates because I have a scenario where Pi A may have a SI7020 sensors and Pi B may have a HTU21D sensor. Both of these sensors use the same i2c address, which is 0x40.

I would like to have one consistent config.txt file, across all Pi devices if possible. So the dtoverlay configuration as follows is the desired result such that on Pi A and Pi B...

Code: Select all

dtoverlay=i2c-sensor,si7020,addr=0x40
dtoverlay=i2c-sensor,htu21,addr=0x40
But I suspect what I have to do is...
Pi A...

Code: Select all

#dtoverlay=i2c-sensor,si7020,addr=0x40
dtoverlay=i2c-sensor,htu21,addr=0x40
Pi B...

Code: Select all

dtoverlay=i2c-sensor,si7020,addr=0x40
#dtoverlay=i2c-sensor,htu21,addr=0x40
It would be nice if the dtoverlay logic was smart enough to only use the actual entry that is applicable, I hope this is actually the case.

trejan
Posts: 2929
Joined: Tue Jul 02, 2019 2:28 pm

Re: How does dtoverlay support for sensors handle i2c address duplicates?

Fri Aug 07, 2020 4:04 am

Use a serial number filter for config.txt.
Schorschi wrote:
Fri Aug 07, 2020 3:56 am
It would be nice if the dtoverlay logic was smart enough to only use the actual entry that is applicable, I hope this is actually the case.
That isn't possible as there is no standardised autodetection mechanism for I2C. The only way you can identify something at a specific address is to read the registers and cross reference it against the datasheets. The Pi firmware isn't going to do that.

Return to “General discussion”