I am new to world of MicroPython, so I am sorry if it's something obvious, but I can't figure it out.
I have problem with reading from SHT4x sensor. It's connected through X9 and X10 as SoftI2C. It is connected with 3 other sensors on same interface. I can write commands but when I want to read, it shows "OSError: [Errno 19] ENODEV". scan() can see this device and writeinto() also sees it. When I use readinto() it reads all bytes as 0xff, but I want to read from specific address because there are more sensors on interface. I tried different pullup resistors(4.7k,3.3k,1.8k) and all do the same, but with 3.3k sometimes even writeinto() gets "OSError: [Errno 19] ENODEV"
Link to datasheet:https://download.mikroe.com/documents/d ... asheet.pdf
This is simplified version of code:
Code: Select all
SHT4x_ADDRESS = const(0x44)
SHT4X_MEASURE = bytearray('\xFD')
sht4x_device = SoftI2C(scl = Pin('X9'), sda = Pin('X10'), freq = 400000)
scan = sht4x_device.scan()
print(scan)
print(sht4x_device)
sht4x_device.writeto(SHT4x_ADDRESS, SHT4X_MEASURE)
pyb.delay(10)
unit = sht4x_device.readfrom(SHT4x_ADDRESS, 6)
temp_data = unit[0:2]
temp_crc = unit[2]
humidity_data = unit[3:5]
humidity_crc = unit[5]
[68, 108, 109]
SoftI2C(scl=B14, sda=B15, freq=500000)