mshmelev / RPi.I2C.Net

Library for working with I2C bus on Raspberry Pi
MIT License
34 stars 23 forks source link

BeagleBone A5 on Ubuntu #1

Open Adam-Anderson opened 11 years ago

Adam-Anderson commented 11 years ago

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:~$

mshmelev commented 11 years ago

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 notifications@github.comwrote:

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 .

Adam-Anderson commented 11 years ago

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);

mshmelev commented 11 years ago

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 notifications@github.comwrote:

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 .

Adam-Anderson commented 11 years ago

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

cayassir commented 9 years ago

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

Adam-Anderson commented 9 years ago

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

Sent from Outlook

_____________________________

From: cayassir notifications@github.com Sent: Wednesday, August 19, 2015 3:18 am Subject: Re: [RPi.I2C.Net] BeagleBone A5 on Ubuntu (#1) To: mshmelev/RPi.I2C.Net rpi.i2c.net@noreply.github.com Cc: Adam-Anderson github@c-it.com.au

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 commented 9 years ago

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" notifications@github.com 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.