How to read gpio every 20 µs

Hi

I’m trying to read out a DHT11.

This involves setting a gpio to OUTPUT and 0, then back to INPUT. The result is, the input is constant 1.

If it worked, the input would be flickering every 20 microseconds, and the data could be extracted accordingly.

On raspberry pies, this works. There are a lot of python examples and a C example based on wiringPI. This ultimately accesses /dev/mem to get the data (bypassing the usual Linux interfaces), and it works (On very old pis some bits tend to get lost).

However, if I try this with libmraa on rockpi, this uses the old Linux interface like accessing /sys/class/gpio/gpio11/value. The gpio number is correct (translated from pin 3 on the header. The result is a constant 1.

There is another way, which works only on kernels after 4.8. It involves a new interface with ioctls on /dev/gpio… devices, and I tried it using the libgpiod library, on a Rock Pi S and on a different board with rockchip. This also shows a constant 1 value in all cases.

What is going on? Does this chip not pass through any 20µs signals st all? Does this Linux kernel interface cache the first value it gets, and not pass through any later changes? Or is the output not getting through correctly? (It remains set for 1 ms in the mraa example, and 18 ms in my gpiod based test)