Nerves_livebook V12.1 returns {:error, -4} when reading using DHT.read

Hi,
I have created a new nerves_livebook.fw to use version 12.1 of livebook. The firmware worked perfectly. But when I try to read from DHT11 sensor, it returns {:error, -4} as shown below:

With the same settings and connections, I switched back to nerves_livebook.fw that has version 11.4 and it worked flawlessly as shown:

I have tried different GPIO pins with the same result. Disconnecting the sensor will give the same {:error, -4}. Any idea why?

I have tried again to read from DHT11 sensor on nerves_livebook of version 0.12.1 and still having the same error. I think there is a bug with this version. Can anyone confirm it?
nerves_livebook v0.11.4 and older versions do not have this issue
Thanks.

Can you tell me What version of the nerves system is being used for each livebook firmware you’re testing with? Also, which circuits_gpio version is being used with each? There was an underlying change to GPIOs somewhat recently and it may be DHT needs adjusting to also handle that.

However, I’m traveling right now and can’t investigate real deep, but will try to think through ideas when I can

Thank you @jjcarstens for your reply. The versions are:

nerves_livebook nerves nerves_system_rpi4 circuits_gpio dht11 reading status
0.9.1 “~> 1.10” “~> 1.21” “~> 1.0” working
0.10.1 “~> 1.10” “~> 1.22” “~> 1.0” working
0.11.0 “~> 1.10” “~> 1.24” “~> 1.0” working
0.12.2 “~> 1.10” “~> 1.26” “~> 2.0 or ~> 1.0” not working, returns {:error, -4}

Have a nice trip :beach_umbrella:

What target are you using? rpi4? I need the nerves_system_* version of whatever targets/hardware you’re testing with too if possible

Oh, my bad. I’m using RPi4. I have updated the table in my previous message adding the nerves_system_rpi4 column which contains the corresponding versions…

Sorry I got behind here. I’m now back and had a chance to look at this.

Error -4 is DHT_ERROR_GPIO which in this case is a result of /dev/gpiomem missing which is what DHT uses to make mmap of and read from.

Looks like it was removed with 62e0d10. It seems to be inadvertent since the other rpi systems have it enabled.

I’ve added it back in nerves_system_rpi4#227 and will be available in the next system release (if accepted)

Thank you @jjcarstens for your reply. I will be waiting for the next system release to give it a try. :wink: