net4801 JP5 User I/O with gpioctl

View: New views
2 Messages — Rating Filter:   Alert me  

net4801 JP5 User I/O with gpioctl

by detourdog :: Rate this Message:

| View Threaded | Show Only this Message

Hey All,

I have a net4801running what I think is a highly modified OpenBSD 3.6. I'm trying to use the gpioctl and although it appears to work on the command line I can see no evidence of it working with my multi-meter.

I have done a lot of looking at this topic on the internet and I found various discussions on using gpioctl and some recommendations about configuring the pins prior to  entering the secure level 1.
My systems happens to have an /etc/rc.securelevel mine looks like this.


# cat /etc/rc.securelevel                                                      
#       $FabBSD$
#       $OpenBSD: rc.securelevel,v 1.16 2004/07/06 04:05:03 deraadt Exp $
#
# site-specific startup actions, daemons, and other things which
# can be done BEFORE your system goes into securemode.  For actions
# which should be done AFTER your system has gone into securemode
# please see /etc/rc.local

# This is the desired security level
securelevel=1

echo -n 'starting pre-securelevel daemons:'

#
# Place local actions here.
#
/usr/sbin/gpioctl -c 01 out;
/usr/sbin/gpioctl -c 03 out;


echo '.'


The boot process produces this output which makes me think it is working:

starting pre-securelevel daemons:pin 1: caps: in out, flags: -> out
pin 3: caps: in out, flags: -> out
.
setting kernel security level: kern.securelevel: 0 -> 1


Finally I think it is not working because I expect this command:

# gpioctl -d /dev/gpio0 1 0

to make either pin 1 or pin4 of JP5 low or zero voltage.

I also expect it to hold that value until I change it with another command.

here is a transcript of me interrogating JP5 pins.

# gpioctl -d /dev/gpio0 1  
pin 1: state 1
# gpioctl -d /dev/gpio0 1 0
pin 1: state 0 -> 0
# gpioctl -d /dev/gpio0 1  
pin 1: state 1
# gpioctl -d /dev/gpio0 3
pin 3: state 1
# gpioctl -d /dev/gpio0 3 0
pin 3: state 0 -> 0
# gpioctl -d /dev/gpio0 3  
pin 3: state 1

Interactively I can manually create the ports which also doesn't work.
Here is a transcript:

# gpioctl -d /dev/gpio0 -c 01 out
pin 1: caps: in out, flags: out -> out
# gpioctl -d /dev/gpio0 1        
pin 1: state 1
# gpioctl -d /dev/gpio0 1 0      
pin 1: state 0 -> 0
# gpioctl -d /dev/gpio0 1  
pin 1: state 1

Finally the verison of gpioctl doesn't support pp in fact it only seems to support in and out as flags.
# gpioctl -d /dev/gpio0 -c 01 pp  
gpioctl: GPIOPINCTL: Operation not supported by device


I know I'm not helping myself by using some strange BSD variant but I have heard it works. I would like any guidance on how to further investigate the issue. My next step will probably be to go to netbsd and see if I can get the custom software I need off the old machine.

Any ideas welcome.

Ben


_______________________________________________
Soekris-tech mailing list
Soekris-tech@...
http://lists.soekris.com/mailman/listinfo/soekris-tech

Re: net4801 JP5 User I/O with gpioctl

by detourdog :: Rate this Message:

| View Threaded | Show Only this Message

Well I got it sorted out and here are the best summery I can come up with.

The Soekris Net4801 has it's JP5 20 pin connector on /dev/gpio1
The command to configure a pin to go high or low is

/usr/sbin/gpioctl -d /dev/gpio1 -c 16 set out pp jp5pin12
Would configure Pin 3 in the JP5 document.

This worked for me on an older OpenBSD.
I believe a newer version would require that line in the /etc/rc.securelevel.

I found that it made no difference I could enter interactively to configure pins.
Thanks,

Ben




On Mar 15, 2012, at 2:06 PM, Ben Greenfield wrote:

> Hey All,
>
> I have a net4801running what I think is a highly modified OpenBSD 3.6. I'm trying to use the gpioctl and although it appears to work on the command line I can see no evidence of it working with my multi-meter.
>
> I have done a lot of looking at this topic on the internet and I found various discussions on using gpioctl and some recommendations about configuring the pins prior to  entering the secure level 1.
> My systems happens to have an /etc/rc.securelevel mine looks like this.
>
>
> # cat /etc/rc.securelevel                                                      
> #       $FabBSD$
> #       $OpenBSD: rc.securelevel,v 1.16 2004/07/06 04:05:03 deraadt Exp $
> #
> # site-specific startup actions, daemons, and other things which
> # can be done BEFORE your system goes into securemode.  For actions
> # which should be done AFTER your system has gone into securemode
> # please see /etc/rc.local
>
> # This is the desired security level
> securelevel=1
>
> echo -n 'starting pre-securelevel daemons:'
>
> #
> # Place local actions here.
> #
> /usr/sbin/gpioctl -c 01 out;
> /usr/sbin/gpioctl -c 03 out;
>
>
> echo '.'
>
>
> The boot process produces this output which makes me think it is working:
>
> starting pre-securelevel daemons:pin 1: caps: in out, flags: -> out
> pin 3: caps: in out, flags: -> out
> .
> setting kernel security level: kern.securelevel: 0 -> 1
>
>
> Finally I think it is not working because I expect this command:
>
> # gpioctl -d /dev/gpio0 1 0
>
> to make either pin 1 or pin4 of JP5 low or zero voltage.
>
> I also expect it to hold that value until I change it with another command.
>
> here is a transcript of me interrogating JP5 pins.
>
> # gpioctl -d /dev/gpio0 1  
> pin 1: state 1
> # gpioctl -d /dev/gpio0 1 0
> pin 1: state 0 -> 0
> # gpioctl -d /dev/gpio0 1  
> pin 1: state 1
> # gpioctl -d /dev/gpio0 3
> pin 3: state 1
> # gpioctl -d /dev/gpio0 3 0
> pin 3: state 0 -> 0
> # gpioctl -d /dev/gpio0 3  
> pin 3: state 1
>
> Interactively I can manually create the ports which also doesn't work.
> Here is a transcript:
>
> # gpioctl -d /dev/gpio0 -c 01 out
> pin 1: caps: in out, flags: out -> out
> # gpioctl -d /dev/gpio0 1        
> pin 1: state 1
> # gpioctl -d /dev/gpio0 1 0      
> pin 1: state 0 -> 0
> # gpioctl -d /dev/gpio0 1  
> pin 1: state 1
>
> Finally the verison of gpioctl doesn't support pp in fact it only seems to support in and out as flags.
> # gpioctl -d /dev/gpio0 -c 01 pp  
> gpioctl: GPIOPINCTL: Operation not supported by device
>
>
> I know I'm not helping myself by using some strange BSD variant but I have heard it works. I would like any guidance on how to further investigate the issue. My next step will probably be to go to netbsd and see if I can get the custom software I need off the old machine.
>
> Any ideas welcome.
>
> Ben
>
>
> _______________________________________________
> Soekris-tech mailing list
> Soekris-tech@...
> http://lists.soekris.com/mailman/listinfo/soekris-tech

_______________________________________________
Soekris-tech mailing list
Soekris-tech@...
http://lists.soekris.com/mailman/listinfo/soekris-tech