I2C on Allwinner NanoPI Neo2
Emmanuel Vadot
manu at bidouilliste.com
Wed Apr 24 11:00:47 UTC 2019
Hi Manuel,
On Wed, 24 Apr 2019 12:21:34 +0200
Manuel Stühn <freebsdnewbie at freenet.de> wrote:
> Hi,
>
> On my Allwinner NanoPI NEO2 (H5 aarch64 based) the I2C("allwinner,sun6i-a31-i2c" compatible, debug messages enabled) shows this message:
>
> root at bsd-nanopi:~ # i2c -v -f /dev/iic0 -a0x3c -d r -c 1
> dev: /dev/iic0, addr: 0x3c, r/w:twsi_locked_start(): no ACK (status: 08) after sending slave address r, offset: 0x00, width: 8, count: 1
> ioctl: error sending start condition
>
> while trying to communicate with the attached NanoHAT OLED (SSD1306 based I2C 0.96inch 128x64 display).
>
> Observing the bus with a logic analyzer shows, that between start condition and the address write there is a 10ms pause. Then the address gets written correctly and
> the device answers ACK. The I2C-clock is 100kHz which is confirmed by logic analyzer.
>
> I'm assuming that this long delay between start condition and address write causes this error, but i do not find any problem in the i2c driver(iicbus/twsi*). I've crosschecked the board with the default Linux image, and I2C works there without problems and there is no visible delay between start and addr-wr.
>
> Any ideas?
>
> --
> Manuel
i2c(8) uses the start/stop/read/write ioctls on the i2c device and
those don't use interrupts but a lots of DELAY calls. I've spent a few
hours trying to make things work without interrupts but gave up and
added i2c_transfer support to twsi that supports interrupts.
I guess that adding I2CRDWR (the ioctls that will call i2c_transfer)
to i2c(8) will not be that hard. So either do that or just code a
little program that suits your needs (see
https://lists.freebsd.org/pipermail/freebsd-arm/2019-April/019672.html
for more info on this).
Cheers,
--
Emmanuel Vadot <manu at bidouilliste.com> <manu at freebsd.org>
More information about the freebsd-arm
mailing list