Enable/Disable Core MyPi Integrator Board IO Devices

Several GPIO lines are reserved for configuring the on board peripherals and usage of the front LEDs.

By using a device tree file we can configure these GPIO lines and drive as desired very early in the power up boot stage, the customised device tree file dt-blob.bin is stored in /boot (see 'Device tree and overlay files' in Installing Linux section for more information)

The source file for this is located in /root/device-tree and is fully documented with instructions for enabling/disabling core features and re-compiling.

By using a bash script (mypi.sh) as part of the init startup sequence we can also configure GPIO line states, shortcuts and user level access, this is located in /etc/init.d/mypi.sh

GPIO
Function Operation Shortcut Default Boot State
23 mPCI-E Reset (#PERST) 1=Active 0=Inactive GPIO23 (FIT LK12 to enable) Inactive
39 mPCI-E Wireless Disable (#WDIS) 1=Disable 0=Enable /dev/pcie-disable Enabled
34 SD Card (/Reset) Enable/Disable 1=Disable 0=Enable /dev/sd-disable Enabled
44 LAN (/Reset) Enable/Disable 1=Disable 0=Enable /dev/lan-disable Enabled
35 Status LED Red 1=On 0=Off /dev/led-red Off
36 Status LED Green 1=On 0=Off /dev/led-green Off

The shortcuts are symlinks created by the mypi.sh file to the respective GPIO exports in /sys/class/gpio

Note that when the LAN/mPCIE/SD interfaces are disabled the respective chip is held in reset mode, which removes the device from the OS, this reduces the boards overall power consumption - significantly in some cases.

 

By using echo commands at the command line shell prompt as root user (or sudo) you can change the state of the GPIO lines

e.g. 

# echo 1 >/dev/led-green
# echo 0 >/dev/led-green

 

When run as root user the above will toggle the state of the green front panel status LED

 

With careful sequencing it is even possible to disable and re-enable the LAN chip for extra power saving, the key here is to shut-down any and all LAN interfaces and services before disabling the chip. 

e.g.

# /etc/init.d/ssh stop
# /etc/init.d/networking stop
# echo 1 >/dev/lan-disable
...
# echo 0 >/dev/lan-disable
# /etc/init.d/networking start
# /etc/init.d/ssh start

 

For more information on how to use GPIO lines the following pages give some useful info :

mypi.sh source file

Devicetree source files

Config.TXT documentation

Device-Tree Overlay Documentation

BCM2835 PIN ALT MODES

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us