I2c issue fez portal

I have a AHT20 sensor and had some issues to get it work
As I do not have any issues anymore to connect my Fez portal after the hub change, I did my preliminary test with it
Process is quite simple. After initialization, you need to trigger the measurement (Temp / Hum), wait 120 ms to allow the sensor to acquire the data
Then you get 7 bytes (status word + 5 bytes for temp and humidity (20 bits each) and the Crc8
With the portal, I get garbage (Temp is 15 instead of 22, humidity is fluctuating and Crc8 calculation doesn’t match. If you heat the sensor the temp goes suddenly down
I tough first I had issue with the code then with the sensor.
I tried with one sensor from Adafruit and got the same result.
Then I tried with a feather and got my results (correct RH and Temp, correct CRC. I did the test on 2 feather.
same code of course, the only difference is the port
//_aht20 = new AHT20TempHum(false, FEZFeather.I2cBus.I2c1);
_aht20 = new AHT20TempHum(false, FEZPortal.I2cBus.I2c1);
I also tried to use the second i2c on the header (pb8/pb9) with the same result.
The funny thing is if I use the logic analyser. the signal I have give me the same value as the one I read (as expected) but for the feather not. here even the clock seems to have some glitches
Could I have a portal with a defective i2c ?

note : for the next fez portal revision, it would be nice to use the mikroe socket. much better than a normal header

Can I understand that data on analyzer and FEZ Portal are different, but analyzer and Feather are same?

If I look at the data on the logic analyser for the portal; the data displayed on the analyser match the one I have in the receive buffer. but data are not correct. scl is normal. I have attached a screen shot.
for the feather, data seen on the feather i2c bus are not what i have in the received buffer and the clock line has glitches (but data received are ok)
I will reconnect the feather and show you the analyser screenshot in 5 min

and here the analyser output for the feather
data received ar (dec) 28/79/71/5/251/6/69
No match but readings received and crd ore OK
also a detail of the clock on the right

Portal and feather use same firmware but could be different i2c pins, even same port.

Try use software i2c to see if same issue. You may need pull up resistors. Software i2c on same pins should give same result on both devs.

I think that your problem with the FEZ Portal is that it’s Display Touchscreen uses the same I2C Slave Address as the AHT20. Both use 0x38. You will need to use a I2C multiplexer in order to use the AHT20 on a FezPortal or you can disconnect the FPC Cable from the back of the board.

1 Like

Hi Dat, Scardinale

Both solution work :slight_smile:

I tried the software i2c and it works just fine (with pull-up)

Regarding the I2C conflict address, I didn’t remove the display (connector seems really well attached and don’t want to break it) but instead I tried with a Temp-Humi13 click board (I2c 0x40) and it works fine.
It never used this Fez portal before with I2C
Maybe good to indicate this in the documentation

I had a look at the i2c mux but as far as i understand the 2 devices needs to be connected to the output of the mux; quite difficult to connect the display there

thanks a lot

1 Like