ENV III Causes CoreS3 to restart.
ajb2k3 last edited by ajb2k3
have you tied with the
Init buit-in hardware at beginningblock a the top of setup? (Or without it?)
That's strange, why did the block end up at the bottom.
That would make sense it being at the top.
EDIT: nope still crashes when querying the sensor.
Anybody got this working?
I am facing the same issue.
I tried to use Port B instead or port A, but the behavior is exactly the same: the device reboots when
cdouglas845 last edited by
I have exactly the same issue. The ENV call from the unit library to initialise it causes the reboot:
env3_0 = ENV(i2c=i2c0, type=3)
I can remove that, then do a scan on i2c0 and fetch the addresses of the sensors: [68, 112]
I can then interface with I2C directly to read from the correct address and pull data from the buffer. That proves the ENV3 is connected correctly and that I2C isn't broken.
It looks like a library issue for ENV3 I guess?
I've also tried sending a command on I2C to the sensor to initiate a temperature measurement (writing 0x2C06) however I must be doing something wrong there as it then fails to allow me to read from the device any more and I have to hard reset it before I can continue.
ajb2k3 last edited by
I’ve reported it to M5STACK and they are looking into it
csierra67 last edited by
A workaround is to use Core or Core2 with Env III and UI Flow
cdouglas845 last edited by cdouglas845
@ajb2k3 Ok thanks.
FYI and anyone else that would like to get the ENV III data on CoreS3, I managed to get it working using I2C directly.
Here is the code to go in your loop assuming I2C has been initialised as the default i2c0 variable:
i2c0.writeto(68, '\x2C\x06', True)
data = i2c0.readfrom(68, 6, True)
temp = (((data << 8 | data) * 175) / 0xFFFF) - 45
hum = (((data << 8 | data) * 100.0) / 0xFFFF)
I then output this Temperature (C) and Humidity (%) formatted using (assuming you've initialised label fields already):
mtylerjr last edited by
When I add the ENVIII unit to my CoreS3 on port A, and start it, I get the exception at line 98 of qmp6988.py (the call of reset() )
The issue seems to have been noticed and fixed 8 months ago though, by some guy named Gandro:
It was (seemingly) caused by the QMP6988 chip in the ENVIII resetting in the middle of an I2c transaction during a requested reset (from line 97 of drivers/qmp6988.py), and the driver file not handling the timeout exception causing the exception/crash.
The fix was to just put a try/except around the transaction in reset(), and if the timeout is generated, ignore/handle it.
I found this with 5 minutes of googling. Not sure why M5Stack hasnt fixed it yet for all products that use the QMP6988
@mtylerjr I am not so sure about that...
Even with that change, the module will reset at this line...
What works for me is to bypass the reset(), after that I get correct temperature/pressure; but once you reset, the next
readfrom_mem()will reset the MCU
mtylerjr last edited by
@amedee I think you are right. I think that fix has already been pushed, and the exception is on the readfrom_mem() now, like you say.
It seems like the same approach would work for that line as well.
If you are desperate to get it running, I have forked the micropython-m5stamp-c3u library and removed the QMP6988 reset().
Unfortunately I have not found a way to override the built-in libraries, so it needs some code blocks in UiFlow...
First install the libraries:
import mip mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/sht30.py", target="/flash/libs") mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/checksum.py", target="/flash/libs") mip.install("https://raw.githubusercontent.com/AmedeeBulle/micropython-m5stamp-c3u/main/lib/qmp6988.py", target="/flash/libs")
Once done you can query both sensors -- e.g:
There are basically 3 code blocks:
import sht30 import qmp6988
sht = sht30.SHT30(i2c0) qmp = qmp6988.QMP6988(i2c0)
temperature, pressure = qmp.measure() pressure = pressure / 100 temperature2, humidity = sht.measure()
Note that in the above example, my ENV-III is plugged in the Port B, if you use Port A, adjust SCL/SDA accordingly!