Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opening 2 different I2C devices #42

Open
dumpKopf2 opened this issue Nov 11, 2014 · 1 comment
Open

opening 2 different I2C devices #42

dumpKopf2 opened this issue Nov 11, 2014 · 1 comment

Comments

@dumpKopf2
Copy link

Greetings,

I have a Cape connected to a BBB board that has an RTC chip connected to I2C2 and an I/O expander that connects to I2C1. If I run the code for each separately in different javascript files things work well. When I combine the two codes together, the software crashes.
Here is a snippet of what I have:
var b = require("bonescript")
// RTC
var port = '/dev/i2c-2';
var address = 0x68;
var writeArray = [];
var readArray = [];

// GPIO
var port2 = 'dev/i2c-1';
var gpioAddress = 0x27;
var timerOperation;
var gpioWriteArray = [];

b.i2cOpen(port, address, {}, setupRTC);
readRTCTime();
console.log("UTC Time: " + getTime());
console.log("UTC date: " + getDayAndMonth());
console.log("Alarm is set for 20 seconds from now");

b.i2cOpen(port2, gpioAddress, {}, setupMCP23008);
^^^^^^^^^ crashes here with the following dump ^^^
UTC Time: 22:32:48
UTC date: 11/11/2014
Alarm is set for 20 seconds from now

/usr/local/lib/node_modules/bonescript/iic.js:15
if(m.ports[args.port].path) path = m.ports[args.port].path;
^
TypeError: Cannot read property 'path' of undefined
at Object.m.doOpen (/usr/local/lib/node_modules/bonescript/iic.js:15:26)
at Object.newFunction as i2cOpen
at Object. (/var/lib/cloud9/javascripts/testJig/RTC_GPIO.js:27: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)
at startup (node.js:119:16)
at node.js:902:3

ls -l /sys/bus/i2c/devices/i2c-* yields the following output:
lrwxrwxrwx 1 root root 0 May 15 03:41 /sys/bus/i2c/devices/i2c-0 -> ../../../devices/ocp.3/44e0b000.i2c/i2c-0
lrwxrwxrwx 1 root root 0 May 15 03:41 /sys/bus/i2c/devices/i2c-1 -> ../../../devices/ocp.3/4819c000.i2c/i2c-1
lrwxrwxrwx 1 root root 0 Nov 11 22:09 /sys/bus/i2c/devices/i2c-2 -> ../../../devices/ocp.3/4802a000.i2c/i2c-2

What am I doing wrong?

Thanks in advance,

Mostafa

@rzr
Copy link

rzr commented Oct 20, 2020

Is this issue still relevant on latest @abandonware's fork ?

https://libraries.io/npm/@abandonware%2Fi2c/usage

Relate-to: #97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants