EBC Disabling HDMI

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.

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.

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); }
 * 1) !/usr/bin/env node

/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. (/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 the other pins though.

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$ cd exercises/gpio bone$ vi /boot/uEnv.txt

cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
 * 1) Disable HDMI

bone$ reboot

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_27 P8_28 P8_29 P8_30 P8_31 P8_32 P8_33 P8_34 P8_35 P8_36 P8_37 P8_38 P8_39 P8_40 P8_41 P8_42 P8_43 P8_44 P8_45 P8_46 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_25 P9_26 P9_27 P9_28 P9_29 P9_30 P9_31 P9_41 P9_42 USR0 USR1 USR2 USR3 Now, P9_25 is free for you to use and the BoneScript code above will run without error.