RPi.I2C.Net icon indicating copy to clipboard operation
RPi.I2C.Net copied to clipboard

BeagleBone A5 on Ubuntu

Open Adam-Anderson opened this issue 12 years ago • 7 comments

I'm compiling the SampleApp in VS 2012 Express, it compiles fine and can read from devices, but any attempt to write to the bus causes an exception.

ubuntu@ubuntu-armhf:~$ sudo mono SampleApp.exe Using the following Bus: /dev/i2c-1

Unhandled Exception: System.IO.IOException: Error writing to address '56': I2C transaction failed at RPi.I2C.Net.I2CBus.WriteBytes (Int32 address, System.Byte[] bytes) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Error writing to address '56': I2C transaction failed at RPi.I2C.Net.I2CBus.WriteBytes (Int32 address, System.Byte[] bytes) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 ubuntu@ubuntu-armhf:~$

Adam-Anderson avatar Jul 09 '13 12:07 Adam-Anderson

Usually you get this error when you don't have a slave I2C device on this address. Try i2cdetect command to check if it's there (smth like: sudo i2cdetect -y 1, I don't remember now the exact syntax).

On Tue, Jul 9, 2013 at 8:28 AM, Adam-Anderson [email protected]:

I'm compiling the SampleApp in VS 2012 Express, it compiles fine and can read from devices, but any attempt to write to the bus causes an exception.

ubuntu@ubuntu-armhf:~$ sudo mono SampleApp.exe Using the following Bus: /dev/i2c-1

Unhandled Exception: System.IO.IOException: Error writing to address '56': I2C transaction failed at RPi.I2C.Net.I2CBus.WriteBytes (Int32 address, System.Byte[] bytes) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Error writing to address '56': I2C transaction failed at RPi.I2C.Net.I2CBus.WriteBytes (Int32 address, System.Byte[] bytes) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 ubuntu@ubuntu-armhf:~$

— Reply to this email directly or view it on GitHubhttps://github.com/mshmelev/RPi.I2C.Net/issues/1 .

mshmelev avatar Jul 09 '13 12:07 mshmelev

Using the following command to use bus 1 device address 56 data address 0 data value 255 I can turn all the leds Off.

ubuntu@ubuntu-armhf:~$ sudo i2cset 1 56 0 255 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will write to device file /dev/i2c-1, chip address 0x38, data address 0x01, data 0xff, mode byte. Continue? [Y/n] y ubuntu@ubuntu-armhf:~$

Turns all the LED's off.

in C# I'm using res[0] = 0x00 // Set data address to 0 res[1] = 0xFF; // Set data value to 255 (all 1's). bus.WriteBytes(0x38,res);

Adam-Anderson avatar Jul 09 '13 13:07 Adam-Anderson

Have you recompiled the libnativei2c.so? Because it's precompiled for Arch LInux, not for Debian.

On Tue, Jul 9, 2013 at 9:14 AM, Adam-Anderson [email protected]:

Using the following command to use bus 1 device address 56 data address 0 data value 255 I can turn all the leds Off.

ubuntu@ubuntu-armhf:~$ sudo i2cset 1 56 0 255 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will write to device file /dev/i2c-1, chip address 0x38, data address 0x01, data 0xff, mode byte. Continue? [Y/n] y ubuntu@ubuntu-armhf:~$

Turns all the LED's off.

in C# I'm using res[0] = 0x00 // Set data address to 0 res[1] = 0xFF; // Set data value to 255 (all 1's). bus.WriteBytes(0x38,res);

— Reply to this email directly or view it on GitHubhttps://github.com/mshmelev/RPi.I2C.Net/issues/1#issuecomment-20672756 .

mshmelev avatar Jul 09 '13 13:07 mshmelev

That did it, just had to install gcc on the BeagleBone and recompile now it's working fine. Thanks for the help :100:

Adam-Anderson avatar Jul 09 '13 14:07 Adam-Anderson

Hi, I got this when trying to run the sample, the libnativei2c.so file is in the right place:

Unhandled Exception: System.DllNotFoundException: libnativei2c.so at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string) at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0 at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libnativei2c.so at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string) at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0 at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0

cayassir avatar Aug 18 '15 17:08 cayassir

Hi, you're missing the libnativei2c.soThe compiler can't find the file.

Sent from Outlook

_____________________________

From: cayassir [email protected] Sent: Wednesday, August 19, 2015 3:18 am Subject: Re: [RPi.I2C.Net] BeagleBone A5 on Ubuntu (#1) To: mshmelev/RPi.I2C.Net [email protected] Cc: Adam-Anderson [email protected]

Hi, I got this when trying to run the sample, the libnativei2c.so file is in the right place:

Unhandled Exception: System.DllNotFoundException: libnativei2c.so at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string) at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0 at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libnativei2c.so at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string) at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0 at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0 at SampleApp.Program.Main (System.String[] args) [0x00000] in :0

— Reply to this email directly or view it on GitHub.

Adam-Anderson avatar Aug 21 '15 21:08 Adam-Anderson

Try the master branch, github might have screwed something up when I forked.

Sent from Outlook

On Tue, Aug 18, 2015 at 10:18 AM -0700, "cayassir" [email protected] wrote:

Hi, I got this when trying to run the sample, the libnativei2c.so file is in the right place:

Unhandled Exception:

System.DllNotFoundException: libnativei2c.so

at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string)

at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0

at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0

at SampleApp.Program.Main (System.String[] args) [0x00000] in :0

[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: libnativei2c.so

at (wrapper managed-to-native) RPi.I2C.Net.I2CNativeLib:OpenBus (string)

at RPi.I2C.Net.I2CBus..ctor (System.String busPath) [0x00000] in :0

at RPi.I2C.Net.I2CBus.Open (System.String busPath) [0x00000] in :0

at SampleApp.Program.Main (System.String[] args) [0x00000] in :0

— Reply to this email directly or view it on GitHub.

Adam-Anderson avatar Aug 21 '15 21:08 Adam-Anderson