Accessing GPIOs in userspace, kernel 3.8.13


I would like to connect a humidity sensor (DHT-22) to my beaglebone white which is running latest Ubuntu (from But I can’t read any data from it. About 6 month ago I had the sensor up and running on the same beaglebone, but with an older kernel. The code I’m using to read the sensor can be found here: I have only changed the GPIO pin from P8_3 to P8_6 which is the GPIO I have the sensor conneced to.

I know a lot has happend when a newer kernel were introduced. Is there any change on how the GPIO is handled? Can they be accessed via /dev/mem which seems like the DHT2 code is doing?


Done a litte Möre digging and got a working solution. I verified that the gpio was indeed working and toggled as expected. The DHT22 have very strict timing requirements when it comes to interpret the data sent from the sensor. It is best to do in kernel space. I saw that a driver is in progress for the next linux release so as a interim solution I tweaked the application reading the sensor and introduce some retries. Now it is possible to get a correct reading.