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. 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.

Turning off the HDMI
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

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

bone$ reboot

Now, P9_25 is free for you to use and the BoneScript code above will run without error.