Trinket M0 + DHT 22 Issue: Bitbanging Exception

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Peterzhao
 
Posts: 1
Joined: Fri Dec 03, 2021 5:41 pm

Trinket M0 + DHT 22 Issue: Bitbanging Exception

Post by Peterzhao »

Hi everyone!

I currently working on a project with Trinket M0 and DHT22. I'm following the exact tutorials here:
https://learn.adafruit.com/dht/dht-circuitpython-code

I have Circuitpython 7.0.0 installed on the M0. I got the adafruit_dht.mpy file for the 7.x circuitpython . And I copy and pasted the exact code from the tutorial(With the same wiring on D2). But went I ran the code I got the following error:

Traceback (most recent call last):
File "main.py", line 6, in <module>
File "adafruit_dht.py", line 305, in __init__
File "adafruit_dht.py", line 82, in __init__

Exception: Bitbanging is not supported when using CircuitPython.
Code done running.

From reading the DHT library source code:
if "Linux" not in uname() and not self._use_pulseio:
raise Exception("Bitbanging is not supported when using CircuitPython.")

I suspect the issue is use_pulseio is set the False.

And I don't why that's the case. I thought M0 had pulseio enable for the pins?

Any help is appreciated. Thank you!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trinket M0 + DHT 22 Issue: Bitbanging Exception

Post by dastels »

The TrinketM0 does not include pulseio. I don't know why that is presenting a problem... I see if I can get someone more involved to have a look at that logic.

Dave

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trinket M0 + DHT 22 Issue: Bitbanging Exception

Post by dastels »

So, pulseio is only available on full-size CP builds. See https://github.com/adafruit/circuitpython/pull/4696 for background.

Also relevant is https://learn.adafruit.com/modern-repla ... 22-sensors

Dave

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Trinket M0 + DHT 22 Issue: Bitbanging Exception

Post by adafruit_support_carter »

This is due to a change that occurred with 7.x release of CircuitPython. Opened a new issue for this here:
https://github.com/adafruit/Adafruit_Ci ... /issues/78

For now, can try reverting to an older version of CP. Here's a link to 6.3.0 firmware, which is last pre-7.x release:
https://adafruit-circuit-python.s3.amaz ... -6.3.0.uf2

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”