PandaBoard
Nützliches zum Pandaboard. Revision ermitteln. Device Tree editieren. GPIOs muxen, Tasten, RTC und Rotary Encoder über GPIO. UART4 aktivieren.
Installation von Arch Linux
Installation von Arch Linux.
Statische MAC-Adresse
Den U-Boot Bootloader installieren:
pacman -Syu uboot-pandaboard
Danach kann /boot/uEnv.txt
editiert werden:
optargs=smsc95xx.macaddr=06:05:04:03:02:01
Board Revisionen
Liste der PandaBoard Revisionen
Siehe https://marcin.juszkiewicz.com.pl/2010/11/10/how-to-detect-pandaboard-version/
cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 2007.95
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part : 0xc09
CPU revision : 3
processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 2007.95
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x1
CPU part : 0xc09
CPU revision : 3
Hardware : Generic OMAP4 (Flattened Device Tree)
Revision : 0000
Serial : 0000000000000000
Mit devmem2:
devmem2 0x4A002204
/dev/mem opened.
Memory mapped at address 0xb6f74000.
Value at address 0x4A002204 (0xb6f74204): 0x6B95C02F
Laut der Definitionen in https://github.com/atgreen/u-boot-moxie/blob/master/arch/arm/include/asm/arch-omap4/omap.h
#define OMAP4_CONTROL_ID_CODE_ES1_0 0x0B85202F
#define OMAP4_CONTROL_ID_CODE_ES2_0 0x1B85202F
#define OMAP4_CONTROL_ID_CODE_ES2_1 0x3B95C02F
#define OMAP4_CONTROL_ID_CODE_ES2_2 0x4B95C02F
#define OMAP4_CONTROL_ID_CODE_ES2_3 0x6B95C02F
#define OMAP4460_CONTROL_ID_CODE_ES1_0 0x0B94E02F
#define OMAP4460_CONTROL_ID_CODE_ES1_1 0x2B94E02F
#define OMAP4470_CONTROL_ID_CODE_ES1_0 0x0B97502F
ist 0x6B95C02F der Code für die Chip Version 2.3, also ein A4 Board.
GPIO und GPIO Mux
Die Möglichkeit die GPIO über /sys/kernel/debug/omap_mux/
zu muxen existiert in neueren Kernel-Versionen nicht mehr. Das Verzeichnis existiert noch, ist aber leer.
Das muxen der Fuktionen der GPIO muss anscheinend alles über den Device Tree geschehen.
Die Übersicht über die Funktionen der GPIO sind nun ersichtlich in /sys/kernel/debug/pinctrl
Device Tree
Die Device Tree Blobs (= ausführbare Binär Dateien beim Booten) befinden sich in /boot/dtbs
. Hier wird beim booten die dem Board (--> Revision) entsprechende DTB Datei geladen.
DTB über Decompilierung erstellen
DTBs können decompiliert, editiert und wieder compiliert werden. Dies geschieht mit dem Device Tree Compiler (dtc):
pacman -S dtc
Decompilieren einer .dtb Datei:
dtc -I dtb -O dts -o [datei.dts] [datei.dtb]
Compilieren einer .dts Datei
dtc -I dts -O dtb -o [datei.dtb] [datei.dts]
DTB aus Kernelsourcen erstellen
Komfortabel geht es über das Editieren der Quelledateien im entsprechenden PKG Paket.
git clone https://github.com/archlinuxarm/PKGBUILDs.git
cd PKGBUILDs/core/linux-armv7
makepkg -o -s
cd src/linux-4-3
make prepare
Die Dateien des Device Tree befinden sich in arch/arm/boot/dts/
. Editieren und DTB erstellen:
make dtbs
cp arch/arm/boot/dts/omap4-panda-a4.dtb /boot/dtbs/
GPIOs
Für das muxen der GPIOs im Device Tree wird das Technical Reference Manual benötigt. Um die Seite 3336ff finden sich die Auflistung der GPIO und der jeweiligen Funktionen. Die Basis Adresse aller GPIO ist 0x040 (64). Im Device Tree sind die relativen Adressen zu dieser Basis Adresse anzugeben.
Beispiel
gpio_wk7 --> 0x058 [31:16] = 0x05a (90) --> Differenz zu 0x40 (64) = 0x1a (26)
gpio_wk8 --> 0x05c [15:0] = 0x05c (92) --> Differenz zu 0x40 (64) = 0x1c (28)
Verwendet für die beiden Board LEDs in https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/boot/dts/omap4-panda-common.dtsi:
&omap4_pmx_wkup {
led_wkgpio_pins: pinmux_leds_wkpins {
pinctrl-single,pins = <
0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */
0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */
>;
};
};
GPIO-parent
Die gpio-parent werden immer in 32er Gruppen
&gpio1 = 0 .. 31
&gpio2 = 32 .. 63
&gpio3 = 64 .. 95
&gpio4 = 96 .. 127
&gpio5 = 128 .. 159
&gpio6 = 160 .. 191
angegeben. gpio_wk7 ist der siebte GPIO der Gruppe gpio:
leds: leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <
&led_wkgpio_pins
>;
heartbeat {
label = "pandaboard::status1";
gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
};
mmc {
label = "pandaboard::status2";
gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "mmc0";
};
};
Übersicht
Pin / Fkt | Offset (TRM) | Offset (DTS) | GPIO (Parent/Offset) | Funktion / Mode |
---|---|---|---|---|
gpio_wk7 | 0x05a | 0x01a | 1 / 7 | Mode 3 = GPIO |
gpio_wk8 | 0x05c | 0x01c | 1 / 8 | Mode 3 = GPIO |
uart4_rx | 0x15c | 0x11c | Mode 0 = uart4_rx | |
uart4_tx | 0x15e | 0x11e | Mode 0 = uart4_tx | |
GPIO 32 | 0x050 [15:0] | 0x10 | 2 / 0 | Mode 3 = GPIO |
GPIO 33 | 0x050 [31:16] | 0x12 | 2 / 1 | Mode 3 = GPIO |
GPIO 34 | 0x054 [15:0] | 0x14 | 2 / 2 | Mode 3 = GPIO |
GPIO 35 | 0x054 [31:16] | 0x16 | 2 / 3 | Mode 3 = GPIO |
GPIO 36 | 0x058 [15:0] | 0x18 | 2 / 4 | Mode 3 = GPIO |
GPIO 37 | 0x058 [31:16] | 0x1a | 2 / 5 | Mode 3 = GPIO |
GPIO 38 | 0x05c [15:0] | 0x1c | 2 / 6 | Mode 3 = GPIO |
GPIO 39 | 0x05c [31:16] | 0x1e | 2 / 7 | Mode 3 = GPIO |
GPIO 50 | 0x074 [15:0] | 0x34 | 2 / 18 | Mode 3 = GPIO |
GPIO 51 | 0x074 [31:16] | 0x36 | 2 / 19 | Mode 3 = GPIO |
GPIO 52 | 0x078 [15:0] | 0x38 | 2 / 20 | Mode 3 = GPIO |
GPIO 53 | 0x078 [31:16] | 0x3a | 2 / 21 | Mode 3 = GPIO |
GPIO 54 | 0x07c [15:0] | 0x3c | 2 / 22 | Mode 3 = GPIO |
GPIO 55 | 0x07c [31:16] | 0x3e | 2 / 23 | Mode 3 = GPIO |
GPIO 56 | 0x080 [15:0] | 0x40 | 2 / 24 | Mode 3 = GPIO |
GPIO 59 | 0x084 [31:16] | 0x46 | 2 / 27 | Mode 3 = GPIO |
GPIO 60 | 0x088 [15:0] | 0x48 | 2 / 28 | Mode 3 = GPIO |
GPIO 61 | 0x088 [31:16] | 0x4a | 2 / 29 | Mode 3 = GPIO |
GPIO 134 | 0x130 [31:16] | 0xf2 | 5 / 6 | Mode 3 = GPIO |
GPIO 135 | 0x134 [15:0] | 0xf4 | 5 / 7 | Mode 3 = GPIO |
GPIO 136 | 0x134 [31:16] | 0xf6 | 5 / 8 | Mode 3 = GPIO |
GPIO 137 | 0x138 [15:0] | 0xf8 | 5 / 9 | Mode 3 = GPIO |
GPIO 138 | 0x138 [31:16] | 0xfa | 5 / 10 | Mode 3 = GPIO |
GPIO 139 | 0x13c [15:0] | 0xfc | 5 / 11 | Mode 3 = GPIO |
Initialisierung von Geräten und Funktionen
Für ein A4 Board wird die omap4-panda-a4.dts editiert:
MCP7941 RTC
Die MCP7941 RTC ist an I2C4 angeschlossen und wird beim Booten initialisiert. Danach ist sie unter /dev/rtc1
verfügbar.
/** MCP7941 RTC on I2C4 */
&i2c4 {
rtc_mcp7941x: rtc {
compatible = "mcp7941x";
reg = <0x6f>;
};
};
UART4
Die serielle Schnittstelle UART4, verfügbar unter /dev/ttyO3
:
/** Mux UART4 */
&omap4_pmx_core {
uart4_pins: pinmux_uart4_pins {
pinctrl-single,pins = <
0x11c (PIN_INPUT | MUX_MODE0) /* uart4_rx */
0x11e (PIN_OUTPUT | MUX_MODE0) /* uart4_tx */
>;
};
};
/** Mux UART4 */
&uart4 {
pinctrl-names = "default";
pinctrl-0 = <&uart4_pins>;
};
LED
Zusätzliche LED an GPIO139
user_leds: user_leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&led_pins>;
pandaradio {
label = "pandaboard::status3";
gpios = <&gpio5 11 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "default-on";
};
};
&omap4_pmx_core {
led_pins: pinmux_led_pins {
pinctrl-single,pins = <
0xfc (PIN_OUTPUT | MUX_MODE3) /* gpio_139 */
>;
};
};
Rotary Encoder
An den GPIO 136 und 138.
/** Rotary Encoder */
rotary_encoder: rotary_encoder {
compatible = "rotary-encoder";
pinctrl-names = "default";
pinctrl-0 = <&rotary_encoder_pins>;
gpios = <&gpio5 8 0>, <&gpio5 10 0>;
linux,axis = <0>; /* REL_X */
rotary-encoder,relative-axis;
};
/** Mux Rotary Encoder */
&omap4_pmx_core {
rotary_encoder_pins: pinmux_rotary_encoder_pins {
pinctrl-single,pins = <
0xfa (PIN_INPUT | MUX_MODE3) /* 10 MCSPI1_CS1 GPIO_138 ENCODER_A */
0xf6 (PIN_INPUT | MUX_MODE3) /* 12 MCSPI1_SIMO GPIO_136 ENCODER_B */
>;
};
};
Tasten
Eigene Tasten über GPIOs.
/** Mux Keys */
&omap4_pmx_core {
key_pins: pinmux_key_pins {
pinctrl-single,pins = <
0xf4 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 18 MCSPI1_SOMI GPIO_135 AUDIO_INTERN */
0xf2 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 20 MCSPI1_CLK GPIO_134 AUDIO_OFF */
0x1e (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 22 GPMC_AD15 GPIO_39 AUDIO_EXTERN */
0x1a (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 10 GPMC_AD13 GPIO_37 Front_Info */
0x1c (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 9 GPMC_AD14 GPIO_38 Front_Mode */
0x18 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 17 GPMC_AD12 GPIO_36 Front_Extra */
0x10 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 18 GPMC_AD8 GPIO_32 Front_Left */
0x4a (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 19 GPMC_WAIT0 GPIO_61 Front_Up */
0x12 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 20 GPMC_AD9 GPIO_33 Front_Down */
0x3c (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 21 GPMC_NWP GPIO_54 Front_Right */
0x14 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 22 GPMC_AD10 GPIO_34 Front_Center */
0x3e (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 23 GPMC_CLK GPIO_55 Top B */
0x16 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 24 GPMC_AD11 GPIO_35 Top Back */
0x34 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 25 GPMC_NCS0 GPIO_50 Top Info */
0x40 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 26 GPMC_NADV_ALE GPIO_56 Top A */
0x36 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 27 GPMC_NCS1 GPIO_51 Top Mode */
0x46 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* 28 GPMC_NBE0_CLE GPIO_59 Top Center */
>;
};
};
/** Keys */
gpio_keys: gpio_keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&key_pins>;
/* 10 GPMC_AD13 GPIO_37 Front_Info [I] */
front-info {
label = "Front Info";
gpios = <&gpio2 5 0>;
linux,code = <23>;
};
/* 22 GPMC_AD10 GPIO_34 Front_Center [ENTER] */
front-center {
label = "Front Center";
gpios = <&gpio2 2 0>;
linux,code = <28>;
};
/* 9 GPMC_AD14 GPIO_38 Front_Mode [M] */
front-mode {
label = "Front Mode";
gpios = <&gpio2 6 0>;
linux,code = <50>;
};
/* 17 GPMC_AD12 GPIO_36 Front_Extra [F]*/
front-extra {
label = "Front Extra";
gpios = <&gpio2 4 0>;
linux,code = <33>;
};
/* 18 GPMC_AD8 GPIO_32 Front_Left [LEFT]*/
front-left {
label = "Front Left";
gpios = <&gpio2 0 0>;
linux,code = <105>;
};
/* 19 GPMC_WAIT0 GPIO_61 Front_Up [UP]*/
front-up {
label = "Front Up";
gpios = <&gpio2 29 0>;
linux,code = <103>;
};
/* 20 GPMC_AD9 GPIO_33 Front_Down [DOWN]*/
front-down {
label = "Front Down";
gpios = <&gpio2 1 0>;
linux,code = <108>;
};
/* 21 GPMC_NWP GPIO_54 Front_Right [RIGHT] */
front-right {
label = "Front Right";
gpios = <&gpio2 22 0>;
linux,code = <106>;
};
/* 23 GPMC_CLK GPIO_55 Top_B [B] */
top-b {
label = "Top B";
gpios = <&gpio2 23 0>;
linux,code = <48>;
};
/* 24 GPMC_AD11 GPIO_35 Top_Back [ESC] */
top-back {
label = "Top Back";
gpios = <&gpio2 3 0>;
linux,code = <1>;
};
/* 25 GPMC_NCS0 GPIO_50 Top_Info [J] */
top-info {
label = "Top Info";
gpios = <&gpio2 18 0>;
linux,code = <36>;
};
/* 26 GPMC_NADV_ALE GPIO_56 Top_A [A] */
top-a {
label = "Top A";
gpios = <&gpio2 24 0>;
linux,code = <30>;
};
/* 27 GPMC_NCS1 GPIO_51 Top_Mode [N] */
top-mode {
label = "Top Mode";
gpios = <&gpio2 19 0>;
linux,code = <49>;
};
/* 28 GPMC_NBE0_CLE GPIO_59 Top_Center [SPACE] */
top-center {
label = "Top Center";
gpios = <&gpio2 27 0>;
linux,code = <57>;
};
/* 18 MCSPI1_SOMI GPIO_135 AUDIO_INTERN [1] */
audio-intern {
label = "Audio Intern";
gpios = <&gpio5 7 0>;
linux,code = <2>;
};
/* 20 MCSPI1_CLK GPIO_134 AUDIO_OFF [0] */
audio-off {
label = "Audio Off";
gpios = <&gpio5 6 0>;
linux,code = <11>;
};
/* 22 GPMC_AD15 GPIO_39 AUDIO_EXTERN [2] */
audio-extern {
label = "Audio Extern";
gpios = <&gpio2 7 0>;
linux,code = <3>;
};
};
Links zum Device Tree
- https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/omap4-panda-common.dtsi#n190
- https://groups.google.com/forum/#!topic/pandaboard/G48FlAeA7L4
- http://stackoverflow.com/questions/32707808/uart4-with-pandaboard-and-arch-linux
- https://www.socallinuxexpo.org/sites/default/files/presentations/Contemporary%20Device%20Tree.pdf
- http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/
- http://www.linux-magazin.de/Ausgaben/2013/06/Kern-Technik
- https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf