Closed xrmb closed 6 years ago
It is run in userspace and sometimes kernel switches context and you then fail to read the data.
On Tue, Jul 25, 2017 at 2:28 AM, xrmb notifications@github.com wrote:
First of all the code works pretty well and I can easily work around the issue! But sometimes I get random errors like "Invalid CRC" or "Not enough bits". I get what is going on there in the code, I just dont know if it is an issue with my hardware, some timing issue or a sensor issue.
Is that normal?
Thanks in advance. $dht22 -p 71 -d 1000
Humidity: 44.1 % Temperature: 29.2 C Humidity: 44.0 % Temperature: 29.2 C Humidity: 44.0 % Temperature: 29.1 C Humidity: 44.0 % Temperature: 29.1 C Invalid CRC Not enough bits: 0 Not enough bits: 0 Not enough bits: 0 Humidity: 44.0 % Temperature: 29.1 C Humidity: 43.9 % Temperature: 29.1 C Humidity: 44.0 % Temperature: 29.1 C Not enough bits: 39 Not enough bits: 0 Not enough bits: 0 Not enough bits: 0 Humidity: 44.0 % Temperature: 29.1 C
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ayufan-pine64/dht22-pine64/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ACTpQem1BhL4v4DzU_6o_2OzTqKifSD0ks5sRTavgaJpZM4Oh69d .
Would running parts of the code in a "critical section" to avoid context switches solve it? Or would that block to long?
First of all the code works pretty well and I can easily work around the issue! But sometimes I get random errors like "Invalid CRC" or "Not enough bits". I get what is going on there in the code, I just dont know if it is an issue with my hardware, some timing issue or a sensor issue.
Is that normal?
Thanks in advance.
$dht22 -p 71 -d 1000
Humidity: 44.1 % Temperature: 29.2 C Humidity: 44.0 % Temperature: 29.2 C Humidity: 44.0 % Temperature: 29.1 C Humidity: 44.0 % Temperature: 29.1 C Invalid CRC Not enough bits: 0 Not enough bits: 0 Not enough bits: 0 Humidity: 44.0 % Temperature: 29.1 C Humidity: 43.9 % Temperature: 29.1 C Humidity: 44.0 % Temperature: 29.1 C Not enough bits: 39 Not enough bits: 0 Not enough bits: 0 Not enough bits: 0 Humidity: 44.0 % Temperature: 29.1 C