natevw / node-nrf

Pure-JavaScript nRF24L01 driver library
117 stars 31 forks source link

Error: EINVAL: invalid argument, write #59

Open Rocketman21 opened 6 years ago

Rocketman21 commented 6 years ago

Hello! I'm trying to launch a test script on my Orange Pi Zero, node version is 8.9.1, and I execute the command as root user, but I get this error:

> nrf-test@1.0.0 test /root/nrf-test
> node node_modules/nrf/test.js

fs.js:735
    return binding.writeBuffer(fd, buffer, offset, length, position);
                   ^

Error: EINVAL: invalid argument, write
    at Object.fs.writeSync (fs.js:735:20)
    at Object.fs.writeFileSync (fs.js:1301:24)
    at Object.exports.connect (/root/nrf-test/node_modules/pi-pins/index.js:28:16)
    at Object.exports.connect (/root/nrf-test/node_modules/nrf/index.js:32:19)
    at Object.<anonymous> (/root/nrf-test/node_modules/nrf/test.js:23:17)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
npm ERR! Test failed.  See above for more details.

Any ideas why is this happening? Help me please.

natevw commented 6 years ago

Hmm, this happens when the nrf library tries to initialize the GPIO pins (via https://github.com/natevw/pi-pins/blob/79c044540a6efa5400b50d524028b013845858a2/index.js#L28)

The built in test program is configured to use cePin = 24, irqPin = 25 and maybe just a simple mismatch with what is available on the Orange Pi is causing this?

(Otherwise we might need to do a bit more debugging with how the Orange Pi distro has the GPIO devices set up. I found this thread which may/may not help if it comes to that: https://forum.armbian.com/topic/1471-solved-difficulty-accessing-gpio-via-the-sunxi-gpio-export-interface/)