Skip to content

Reset on Init fails when sensor in low-power state #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Cybot101 opened this issue Oct 8, 2020 · 1 comment
Closed

Reset on Init fails when sensor in low-power state #2

Cybot101 opened this issue Oct 8, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@Cybot101
Copy link
Contributor

Cybot101 commented Oct 8, 2020

Using an SAMD21 (Sparkfun Redboard Turbo) with SHTC3 via Quick/StemmaQT.
CP 6.0 beta.

shtc3_simpletest.py example works initially, but subsequent runs after soft-reboot will fail during SHTC3 init. Throws an OS Input/Output error from I2C write. Power cycle works again, until a soft-reset. Rinse, repeat. Possibly related to #1 (though not on rPi)?

Looking at the bus on a scope I can see the soft reset command 0x805D being NAK'd. The SHT address is ACK (so device is okay) but the write to registers is NAK.
I believe it is due to the sensor being put into low-power state after a read. When the soft-reset occurs the device is still asleep and ignores the request.

I have added a call to wake sensor before the soft reset and that appears to stop the error.

Can anyone else confirm similar behaviour? Maybe I'm missing something obvious? Can PR a fix if I'm on the right track.

simpletest.py code for reference

# SPDX-FileCopyrightText: Copyright (c) 2020 Bryan Siepert for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import busio
import board
import adafruit_shtc3

i2c = busio.I2C(board.SCL, board.SDA)
sht = adafruit_shtc3.SHTC3(i2c)

while True:
    temperature, relative_humidity = sht.measurements
    print("Temperature: %0.1f C" % temperature)
    print("Humidity: %0.1f %%" % relative_humidity)
    print("")
    time.sleep(1)
@evaherrada evaherrada added the bug Something isn't working label Oct 8, 2020
@tannewt
Copy link
Member

tannewt commented Oct 8, 2020

Sounds like you found a good fix for #1! A PR would be great. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants