Date: Mon, 11 Sep 2017 15:58:39 -0600 From: Ian Lepore <ian@freebsd.org> To: Maxim Filimonov <che@bein.link>, freebsd-arm@freebsd.org Subject: Re: Raspberry Pi 2 i2c doesn't seem to work Message-ID: <1505167119.32063.84.camel@freebsd.org> In-Reply-To: <96b2c29572af7ef10b5127720bf85724@bein.link> References: <96b2c29572af7ef10b5127720bf85724@bein.link>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2017-09-10 at 20:05 +0000, Maxim Filimonov wrote: > Hello everyone, > > I understand something has been discussed on this matter, however > Google doesn't say anything. > I have a Raspberry Pi 2, and currently I installed FreeBSD 11.1- > STABLE on it. > Works fine, but when I try to detect i2c devices (using `i2c -s -f > /dev/iic1`), it shows nothing. > ktrace/kdump show it has "Device not configured" on every address. > On Linux, the device (address 0x77) detects just fine. > What am I missing? Do I have to configure GPIO pins separately? > Thanks in advance. > As a followup for future searches... the discussion on this moved to irc, and what eventually shook out was that the device was on the i2c bus and working fine. The problem was in the i2c(8) program: "i2c -s" didn't work on some types of i2c controllers. There was no indication that maybe i2c(8) was the problem... when used with a "complete transfers only" i2c controller it just silently claimed no devices were on the bus. So I fixed all that, as best I could. In r323465 I added some code to i2c(8) to use a fallback scan method with controllers that can't do a START/STOP scan. Instead it tries to read a single byte from each device address. This isn't quite as reliable, some devices don't respond to a read that wasn't preceeded by a write of the register address, but writing isn't safe for probing. At least now it tells you it's using a less-reliable fallback scan, so you've got some clue that the problem may be i2c(8) if it doesn't find your device. And most i2c devices do respond to a bare read, so it makes scanning work for most common devices. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1505167119.32063.84.camel>