ds18b20 Temperature Sensor

Benjamin Patterson <[email protected]> Thu, 1 Jul 2021 09:30:31 -0600
Newsgroups gmane.os.netbsd.devel.embedded
Message-ID <CAFsSdzYf3F4w=5Wmf3PTfN_M9i2mdFNUywq61b4N1208F-03fA@mail.gmail.com>
Has anyone had success using a ds18b20 temperature sensor in NetBSD?

I am trying to find the simplest way to read a ds18b20 temperature sensor.

I am using NetBSD 9.2 on Raspberry Pi Zero W.

I connected the sensor supply to 3.3V supply, ground to ground, and
data to GPIO4,

I set gpio=yes in /etc/rc.conf.

Here is what I have tried in my /etc/gpio.conf.
#gpio0 4 set inout #does not work
#gpio0 4 set in #works
#gpio0 4 set out #works
#gpio0 4 set inout #does not work
#gpio0 4 set gpioow # does not work
#gpio0 attach gpioow 4 0x01 #does not work

I think to have "userland" (I think this is the correct term) access
to the temperature sensor, I need "inout" since it is a bidirectional
interface. But this configuration does not seem to work based on
running "gpioctl gpio0" after boot.

I think I am missing a step somewhere.

Any suggestions?

Thanks in advance!