# Is I2C working in BBB  ?



## Nicola Mingotti (May 24, 2019)

Hi,

I am struggling to connect  Adafruit MCP9808 to my BeagleBone Black, FreeBSD 12.

I thought it would have been a pice of cake to configure it, instead I got stuck.

I see the device:

```
#> i2c -s -f /dev/iic1
=> 18    # that is correct
```

But I can't comunicate at all with it via i2c command. 

```
#> i2c -f /dev/iic1 -d r -a 0x18 -o 5  -c 1
ioctl: error sending start condition
```

If I repeat the previous command with truss I see:


```
sigprocmask(SIG_SETMASK,{ },0x0)                 = 0 (0x0)
mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,0,0x0) = 538947584 (0x201fb000)
openat(AT_FDCWD,"/dev/iic1",O_RDWR,00)           = 3 (0x3)
ioctl(3,I2CSTART,0xbfbfec28)                     ERR#19 'Operation not supported by device'
ioctl(3,I2CSTOP,0xbfbfec28)                      = 0 (0x0)
ioctl: error sending start condition
write(2,"ioctl: error sending start condi"...,37) = 37 (0x25)
close(3)                                         = 0 (0x0)
```

Unfortunately the issue seems similar to what was reported 5 year ago by this guy:








						Working with I2C in FreeBSD on Raspberry Pi
					

Unix is well-documented system, but on C language There was no support for I2C in FreeBSD-10.0-RELEASE for Raspberry Pi. It appeared in FreeBSD-10.0-STABLE later. Here is instruction how to use it …




					vzaigrin.wordpress.com
				




I hope some of you has good news.

bye
Nicola


----------



## Nicola Mingotti (May 24, 2019)

I found this in bugzilla, it seems something has been done recently on this point






						189914 – i2c(8) utility does not work on Raspberry Pi
					






					bugs.freebsd.org


----------



## eldaemon (Mar 30, 2020)

Hi Nicola and all,

I'm trying to do a similar thing.

I have a Beaglebone White (one before the Black) and am using FreeBSD 12.1.

I am trying to connect it over I2C to a AM2320 temperature/humidity sensor.

Here is what I get with or without 10k pull-up resistors.


```
root@generic:/usr/include # i2c -f /dev/iic1 -s
Hardware may not support START/STOP scanning; trying less-reliable read method.
Scanning I2C devices on /dev/iic1: <none found>
root@generic:/usr/include # i2c -f /dev/iic1 -s
Hardware may not support START/STOP scanning; trying less-reliable read method.
Scanning I2C devices on /dev/iic1: 5c
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1
ioctl: error sending start condition
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1
ioctl: error sending start condition
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1
ioctl: error sending start condition
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1 -m tr
i2c: ioctl(I2CRDWR) failed: Resource temporarily unavailable
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1 -m tr
i2c: ioctl(I2CRDWR) failed: Device busy
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1 -m tr
i2c: ioctl(I2CRDWR) failed: Device busy
root@generic:/usr/include # i2c -f /dev/iic1 -a 5c -d r -c 1 -m tr
i2c: ioctl(I2CRDWR) failed: Device busy
```

Any ideas?

Here is the spec sheet for the AM2320 if it helps: http://akizukidenshi.com/download/ds/aosong/AM2320.pdf

Thank you!


----------

