# RPi GPIO mapping for gpioctl



## aonishenko (Sep 25, 2017)

Hi!

I use RPi B (early release) and FreeBSD 11.1. 
I use gpioctl to see GPIO pin states and I see, that GPIO pin 6 has OUT state and 1 on it value.

According to this - http://elinux.org/RPi_Low-level_peripherals#P1_Header_pinout.2C_top_row 
GPIO 6 is the ground pin.

How it's possible? Or my gpioctl is wrong..


----------



## Phishfry (Sep 25, 2017)

Your probably going to need a test led to figure out where FreeBSD maps the GPIO.

I usually start with the first GPIO pins after the RTC that I add.
So pins 1,3,5,7,9 for RTC module then for GPIO I start with PIN 11(GPIO17)

This GPIO pin is the same on all Pi boards.

Then for more GPIO I move down to next pin -PIN13, then PIN15 These are mapped to different GPIO locations depending on board.
https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/

Then skip the 3.3V power pin and move to next group of GPIO pins.



aonishenko said:


> gpioctl is wrong..


Yes this is wrong. On early Pi notice there is no GPIO6. Do not confuse this with PIN6. They are not the same.

I would start with the odd numbered pins first. Pins 6,8,10 are for UART console.


----------



## Phishfry (Sep 25, 2017)

Vadim's website is reallly useful.
https://vzaigrin.wordpress.com/2014/04/18/working-with-gpio-on-raspberry-pi-with-freebsd/


----------

