jadonk / bonescript

Scripting tools for BeagleBone and PocketBeagle
http://beagleboard.org
MIT License
514 stars 158 forks source link

USR0/1/2/3 aren't avalable on latest version of kernel #194

Open fr0ster opened 2 years ago

fr0ster commented 2 years ago

I've updated kernel for BeagleBone Black from https://debian.beagleboard.org/images/bone-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz Try execute next script

#!/usr/bin/env node
////////////////////////////////////////
//  blinkLED.js
//      Blinks the USR LEDs and P9_14.
//  Wiring: P9_14 connects to the plus lead of an LED.  The negative lead of the
//          LED goes to a 220 Ohm resistor.  The other lead of the resistor goes
//          to ground.
//  Setup:  
//  See:    
////////////////////////////////////////
const b = require('bonescript');

//const leds = ["USR0", "USR1", "USR2", "USR3"];
const leds = ["P8_14"];

for(var i in leds) {
    b.pinMode(leds[i], b.OUTPUT);
}

var state = b.HIGH;
for(var i in leds) {
    b.digitalWrite(leds[i], state);
}

setInterval(toggle, 250);

function toggle() {
    if(state == b.LOW) 
        state = b.HIGH;
    else
        state = b.LOW;
    for(var i in leds) {
        b.digitalWrite(leds[i], state);
    }
}

And have next messages

error: Unable to find LED beaglebone:green:usr0
error: Unable to find LED beaglebone:green:usr1
error: Unable to find LED beaglebone:green:usr2
error: Unable to find LED beaglebone:green:usr3
error: Unable to find gpio: /sys/class/leds/beaglebone:green:usr0/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr0/brightness
error: Unable to find gpio: /sys/class/leds/beaglebone:green:usr1/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr1/brightness
error: Unable to find gpio: /sys/class/leds/beaglebone:green:usr2/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr2/brightness
error: Unable to find gpio: /sys/class/leds/beaglebone:green:usr3/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr3/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr0/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr1/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr2/brightness
error: Unable to write to /sys/class/leds/beaglebone:green:usr3/brightness
jadonk commented 2 years ago

What process did you use to update the kernel? What do you see with ls -l /sys/class/leds? Can you provide the output of dmesg and/or beagle-version?