GPIO on the
Olimex A20-OlinuXino Micro
with Linux
(Kernel version 3.3.0+ and 3.4.67+)
A guide with Shell and C examples
Dr. Guido Pelz
DM1GP / PY6ZGP
www.dm1gp.com and www.py6zgp.com
26.9.2014
Table of Contents
1. Motivation, Scope and Disclaimer...................................................................................................3
2. Processor Ports and Connectors.......................................................................................................4
2.1 GPIO numbering under kernel 3.3.0+.......................................................................................5
3. The Kernels 3.3.0+ and 3.4.67+ images...........................................................................................6
3.1 Advantages, and Disadvantages of each kernel.........................................................................6
3.2 Kernel 3.3.0+ boot sequence output..........................................................................................7
3.3 Kernel 3.4.67+ boot sequence output........................................................................................8
4. Accessing the GPIO Ports................................................................................................................9
4.1 Read data from a GPIO port......................................................................................................9
4.2 Write data to a GPIO port........................................................................................................10
5. The files script.bin and script.fex...................................................................................................11
5.1 Toolset......................................................................................................................................11
5.2 Content of the script file..........................................................................................................11
6. Modifications to use the LCD connector as GPIO.........................................................................13
6.1 Preparation...............................................................................................................................13
6.2 Disable the LCD display connectivity.....................................................................................14
6.3 Register the ports as GPIO.......................................................................................................16
6.4 Create a new script.bin file......................................................................................................18
6.5 Copy the new file to the /boot directory and reboot................................................................18
6.6 Check the new configuration...................................................................................................19
6.7 Do you like to check the success on the hardware level?........................................................20
6.8 Side effects...............................................................................................................................21
7. Changing the original Port numbering...........................................................................................22
Appendix A: GPIO Test Program for kernel 3.3.0+ and 3.4.67+.......................................................24
Appendix B: GPIO Port Summary.....................................................................................................30
B.1 GPIO Chip PA Ports................................................................................................................30
B.2 GPIO Chip PB Ports................................................................................................................31
B.3 GPIO Chip PC Ports................................................................................................................32
B.4 GPIO Chip PD Ports...............................................................................................................33
B.5 GPIO Chip PE Ports................................................................................................................34
B.6 GPIO Chip PF Ports................................................................................................................35
B.7 GPIO Chip PG Ports...............................................................................................................36
B.8 GPIO Chip PH Ports...............................................................................................................37
B.9 GPIO Chip PI Ports.................................................................................................................38
Appendix C: Connector Summary.....................................................................................................39
C.1 GPIO-1....................................................................................................................................39
C.2 GPIO-2....................................................................................................................................40
C.3 GPIO-3....................................................................................................................................41
C.4 LCD.........................................................................................................................................42