Date: Wed, 24 Apr 2019 13:00:39 +0200 From: Emmanuel Vadot <manu@bidouilliste.com> To: Manuel =?ISO-8859-1?Q?St=FChn?= <freebsdnewbie@freenet.de> Cc: freebsd-arm@freebsd.org Subject: Re: I2C on Allwinner NanoPI Neo2 Message-ID: <20190424130039.2b425b0f3a2dda9affa41952@bidouilliste.com> In-Reply-To: <20190424122134.36e8dc112c62486d00703d4f@freenet.de> References: <20190424122134.36e8dc112c62486d00703d4f@freenet.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Manuel, On Wed, 24 Apr 2019 12:21:34 +0200 Manuel St=FChn <freebsdnewbie@freenet.de> wrote: > Hi, >=20 > On my Allwinner NanoPI NEO2 (H5 aarch64 based) the I2C("allwinner,sun6i-a= 31-i2c" compatible, debug messages enabled) shows this message: >=20 > root@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 >=20 > while trying to communicate with the attached NanoHAT OLED (SSD1306 based= I2C 0.96inch 128x64 display). >=20 > Observing the bus with a logic analyzer shows, that between start conditi= on and the address write there is a 10ms pause. Then the address gets writt= en correctly and=20 > the device answers ACK. The I2C-clock is 100kHz which is confirmed by log= ic analyzer. >=20 > I'm assuming that this long delay between start condition and address wri= te causes this error, but i do not find any problem in the i2c driver(iicbu= s/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 a= nd addr-wr. >=20 > Any ideas? >=20 > --=20 > 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, --=20 Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190424130039.2b425b0f3a2dda9affa41952>