On Tue, 14 Jul 2015 13:27:59 +0200
Piotr Kubaj <pku...@riseup.net> wrote:

> On 06/29/15 03:46, Daniel Bolgheroni wrote:
> > On Wed, Jun 24, 2015 at 05:26:10PM +0200, Piotr Kubaj wrote:
> >> Hi all,
> >>
> >> I'm mainly a FreeBSD user but want to learn OpenBSD. I'm also interested
> >> in basic electronics, like programming own thermometer. That's why I
> >> want to install OpenBSD on my BeagleBone Black and write some simple
> >> programs using I/O pins. Are there any tutorials on this? I have found
> >> some books about FreeBSD kernel programming, but none for OpenBSD.
> >> Thanks for your help.
> >
> > I have a simple example to blink a LED connected to the GPIO here:
> >
> > https://github.com/dbolgheroni/bghbox/blob/master/gpio_blink/gpio_blink.c
> >
> > Most of it I extracted from the OpenBSD gpioctl itself. It's all there.
> >
> > Cheers,
> >
> Hi again,
> 
> at first I was not sure that I had connected it properly, since neither
> you program nor gpioctl(1) seemed to work. Then I tried Debian, with
> which I also couldn't get GPIO to work (using /proc/sys/class/gpio). But
> using the library descriped in
> https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/g
> pio
> and the example program seemed to work (of course after switching to pin
> 10). Can you tell me what is the correct way to access GPIO pins on
> OpenBSD? I did:
> gpioctl gpio1 6 2
> Later I also set flag:
> gpioctl gpio1 6 set out
> But changing states still didn't work.
> 
> Thanks, for your help,
> Piotr Kubaj.
> 
> [demime 1.01d removed an attachment of type application/pgp-signature which 
> had a name of signature.asc]
> 

Hi,

if i remember correctly on Beaglebone Black the 4 on-board-leds are
numberd from 21 to 24. 
If you read the manpage for gpioctl carefully you'll find that
"Only pins that have been configured at securelevel 0, typically 
during system startup, are accessible once the securelevel has been raised."
So put this in your /etc/rc.securelevel
gpioctl gpio1 21 set out

Then once logged  in, this
$ gpioctl gpio1 21 0
should turn the first led off, assuming the user has proper rights for 
/dev/gpio1

Also for testing I prefer the system not to raise the securelevel after boot,
so securelevel=0 in /etc/rc.securelevel

Greetings Ben

Reply via email to