- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I've been trying to read several (i.e. > 2) bytes from a given register of a device on a I2C channel.
I know in C there is a call readBytesReg listed in the documentation (http://iotdk.intel.com/docs/master/mraa/classmraa_1_1_i2c.html mraa: I2c Class Reference):
http://iotdk.intel.com/docs/master/mraa/classmraa_1_1_i2c.html# a811fabe49072ede2144d3118b5b8ba8f readBytesReg (uint8_t reg, uint8_t *data, int length)
but in the Javascript documentation (http://iotdk.intel.com/docs/master/mraa/node/classes/i2c.html# method_I2c I2c), there is no equivalent listed. In the debugger, I see the function attached to my I2C object
but I'm not sure what the parameters are. I tried this:
var buffer = this.i2cChannel.readBytesReg(register,numToRead) ;
and I thought it was working but I'm having trouble with one call in which the numToRead parameter equals 3. I keep getting an "I2c write failed" message.
Can anyone tell me if (1) this call does exist and works within the Javascript bindings and (2) is this the correct way to call it.
Thanks!
- Tags:
- Javascript
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi,
Do you mind posting the full error log and the code you are using? From just "I2c write failed" it's hard to tell if the error was because of the different syntax used in the mraa and Javascript documentation.
You also mention debugging; do you have the output of the debugging log?
Are you using the mini breakout board or the Arduino expansion board? What image version and mraa version are you using?
Sergio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Sergio,
I found the error...turned out to be unrelated in that the chip wasn't coming up. Still it would be nice to have the Javascript version of the documentation (http://iotdk.intel.com/docs/master/mraa/node/classes/i2c.html# method_I2c I2c) reflect the availability of the call and the format.
MRAA version 0.6.2
Yocto...configure_edison --version doesn't work so probably old
Cheers,
Hunter

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page