EBC Disabling HDMI
Embedded Linux Class by Mark A. Yoder
Although BeagleBone Black has some 64 GPIO pins, some are preassigned to other functions using a pin multiplexer. For example the HTML display uses several of the GPIO pins.
Contents
Errors from using pre-assigned ports
The following code reads a button on P9_21 and turns on an LED on P9_25 in response, but it throws an error.
#!/usr/bin/env node var b = require('bonescript'); var led = "P9_25"; var button = "P9_12"; b.pinMode(led, b.OUTPUT); b.pinMode(button, b.INPUT, 7, 'pulldown'); b.attachInterrupt(button, true, b.CHANGE, toggle); console.log("Ready to go"); function toggle(x) { b.digitalWrite(led, x.value); }
/usr/local/lib/node_modules/bonescript/my.js:57 if(slot[0]) { ^ TypeError: Cannot read property '0' of null at Object.exports.load_dt (/usr/local/lib/node_modules/bonescript/my.js:57:20) at Object.exports.create_dt (/usr/local/lib/node_modules/bonescript/my.js:123:33) at Object.exports.setPinMode (/usr/local/lib/node_modules/bonescript/hw_capemgr.js:83:12) at Object.f.pinMode (/usr/local/lib/node_modules/bonescript/index.js:160:15) at Object.<anonymous> (/root/exercises/gpio/hdmiDemo.js:7:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)
One way to see what caused the error is the dmesg command. dmesg prints a log of various kernel messages. Here we'll use the tail command to look at the last few messages.
bone$ dmesg | tail [ 92.924511] bone-capemgr bone_capemgr.9: slot #7: Failed verification [ 784.309317] bone-capemgr bone_capemgr.9: part_number 'bspm_P9_25_f', version 'N/A' [ 784.309394] bone-capemgr bone_capemgr.9: slot #8: generic override [ 784.309410] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 8 [ 784.309427] bone-capemgr bone_capemgr.9: slot #8: 'Override Board Name,00A0,Override Manuf,bspm_P9_25_f' [ 784.309528] bone-capemgr bone_capemgr.9: slot #8: Requesting part number/version based 'bspm_P9_25_f-00A0.dtbo [ 784.309544] bone-capemgr bone_capemgr.9: slot #8: Requesting firmware 'bspm_P9_25_f-00A0.dtbo' for board-name 'Override Board Name', version '00A0' [ 784.310639] bone-capemgr bone_capemgr.9: slot #8: dtbo 'bspm_P9_25_f-00A0.dtbo' loaded; converting to live tree [ 784.310832] bone-capemgr bone_capemgr.9: slot #8: bspm_P9_25_f conflict P9.25 (#5:BB-BONELT-HDMI) [ 784.320199] bone-capemgr bone_capemgr.9: slot #8: Failed verification
The last lines say there is a conflict with P9.25 and the HDMI. Once solution is to turn off the HDMI.
Finding free pins
Here's how you can see what pins are free.
bone$ cd exercises/gpio bone$ freeGPIO.js P8_10 P8_11 P8_12 P8_13 P8_14 P8_15 P8_16 P8_17 P8_18 P8_19 P8_26 P8_7 P8_8 P8_9 P9_11 P9_12 P9_13 P9_14 P9_15 P9_16 P9_17 P9_18 P9_21 P9_22 P9_23 P9_24 P9_26 P9_27 P9_30 P9_41 P9_42 USR0 USR1 USR2 USR3
Notice P9_25 isn't in the list. You should be able to use any of these pins.
Turning off the HDMI at run time
If you need more pins, you can turn off the HDMI and eMMC, if you aren't using them. Do this to see what's in use.
bone$ SLOTS=/sys/devices/bone_capemgr.*/slots bone$ cat $SLOTS 0: 54:PF--- 1: 55:PF--- 2: 56:PF--- 3: 57:PF--- 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
This shows the eMMC and HDMI are both enabled. You can turn either off by doing this with it's slot number.
bone$ echo -5 > $SLOTS bone$ cat $SLOTS
bone$ ./freeGPIO.js
Turning off the HDMI at boot time
The HDMI is enabled at boot time. To prevent it from being enabled, edit /boot/uEnv.txt and uncomment the line shown and reboot.
bone$ vi /boot/uEnv.txt
##Disable HDMI cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
bone$ reboot
Now, P9_25 is free for you to use and the BoneScript code above will run without error.
Embedded Linux Class by Mark A. Yoder