beagleBone Black and Arduino Uno I2C Communication using c

I need to Establish I2C Communication between BeagleBone Black and Arduino Uno.

I use BeagleBone Black with BeagleBoard.org Debian Buster IoT Image 2020-04-06 .

BeagleBone Black i2c pin output 3.2 Volt

Arduino Uno i2c pin output 3.4 Volt

i2c.ino (Arduino Code)

#include <Wire.h>

int X0;

void setup()
{
  Wire.begin(0x14); // Initiate the Wire library
  Serial.begin(9600);
}
void loop()
{
   Wire.beginTransmission(0x14); // Begin transmission 
   Wire.write("abc");
   Wire.write(3);
   delay(10);
   Wire.endTransmission(); // Ends the transmission and transmits the data from the two registers

  if (Wire.available() <= 2 )
  {
    X0 = Wire.read(); // Reads the data from the register
    Serial.print("X0= ");
    Serial.println(X0);
  }
}

For BeagleBone Black :

i2cdetect -l
op ;- all 3 i2c
i2cdetect -r 1  (Connect with P9_17, P918)
op :- --- --- --- ...
i2cdetect -r 2  (Connect with P919_, P920)
op :- --- --- --- ...

Connections

1) BeagleBone Black P9_17 -> Arduino uno (ATMega328p) i2c SCL
   BeagleBone Black P9_18 -> Arduino uno (ATMega328p) i2c SDA
   GND ->GND

2) BeagleBone Black P9_19 -> Arduino uno (ATMega328p) i2c SCL
    BeagleBone Black P9_20 -> Arduino uno (ATMega328p) i2c SDA 
    GND->GND

means in i2c1 and i2c2 no device address detected ?

I also tried pullup connection with

  1. 3.3v to 10kOhm Resistor then I2c_scl
    3.3v to 10kOhm Resistor then I2c_sda

  2. 3.3v to 2.2kOhm Resistor then I2c_scl
    3.3v to 2.2kOhm Resistor then I2c_sda

where i wrong

Please Guide me with Pin Connections and C Code

The i2c port on the am335x does not natively support i2cslave mode by default…

There is a new kernel driver to support i2c slave features here:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/Kconfig#n113

it’s relatively new, so your kernel probally does not have it enabled. No one has previously documented it either on teh BBB.

Regards,

root@beaglebone:~# pwd
/root
root@beaglebone:~# ls
root@beaglebone:~#

no directory in root

That’s 100% expected, /root/ is the root ‘home’ directory… Change directory to / and then run ls…

Regards,

root@beaglebone:/# cd /root/drivers/i2c/Kconfig
bash: cd: /root/drivers/i2c/Kconfig: No such file or directory

Why are you expecting /root/* to any have any file structure, it’s shipped empty…

What wiki/blog/book/etc are you following?

Regards,

you provide me new kernel driver support link:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/Kconfig#n113

in that path is : path: root/drivers/i2c/Kconfig
image

Yeah… On the web server…

Just install v5.4.x-ti : CONFIG_I2C_SLAVE is enabled:

cd /opt/scripts/tools/
git pull
sudo ./update_kernel.sh --ti-channel --lts-5_4
sudo reboot

Then start working on an overlay…

Regards,
Regards,

1 Like