Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Raspberry Pi & i2c bus



On Thursday 17 January 2013 17:25:41 Jonathan A. Kollasch wrote:
> On Tue, Jan 15, 2013 at 11:37:05PM +0000, Dave Tyson wrote:
> > Very impressed with progress so on the Raspberry Pi so I though I would
> > try some more challenging tests :-)
> > 
> > I have been trying to couple up a BMP085 pressure sensor to the I2C bus
> > on the RPI. I have tested it under raspian and it seems to work OK, but
> > I am having a few issues with NetBSD (latest kernel 6.99.16 compiled
> > yesterday)
> > 
> > First problem is i2cscan reports rather more devices on the bus than
> > actually
> > 
> > exist:
> >  /usr/sbin/i2cscan /dev/iic0
> > 
> > /dev/iic0: found device at 0x09
> > /dev/iic0: found device at 0x0a
> > /dev/iic0: found device at 0x0b
> > /dev/iic0: found device at 0x0d
> > /dev/iic0: found device at 0x0e
> > /dev/iic0: found device at 0x0f
> > ...
> > /dev/iic0: found device at 0x71
> > /dev/iic0: found device at 0x72
> > /dev/iic0: found device at 0x73
> > /dev/iic0: found device at 0x74
> > /dev/iic0: found device at 0x75
> > /dev/iic0: found device at 0x76
> > /dev/iic0: found device at 0x77
> > /dev/iic0: 80 devices found
> > 
> > The same thing happens on /dev/iic1 which has nothing attached...
> > 
> > The BMP085 transducer is hard wired at addr 0x77 and under raspian that's
> > all that is reported on iic0. C code to read the device just failed EIO,
> > so I simplified it to just try and read just the top byte of the first
> > calibration register. That failed EIO. Turning on debugging in
> > bcm2835_bsc.c showed that the actual error was CLKT and the slave is
> > clock stretching longer that specified.
> > 
> > The 9 pages of publically available Broadcom documentation on this part
> > of the BSC controller is a complete joke. Has anyone had any success
> > with devices on this bus? Is there any more sensible documentation with
> > maybe some state diagrams or timing :-)
> 
> I only tested bcmbsc(4) with a PCF8583.  I never tried anything via the
> /dev/iic interface.  I agree, the docs are lacking, I had to fall back
> to the Linux implementation for clues.
> 
>       Jonathan Kollasch

Yes, the documentation is pretty useless. Its not clear whether you need to 
pre-load the FIFO before issuing a start if you are sending a command. I'll 
have a lazy play over the next few weeks and see if I iron out some of the 
issues. I am guessing the Linux people had a bit more info or some hand 
holding as without a *lot* of trial and error its hard to see how you could 
write an implementation with the supplied docs.

Cheers,
Dave

-- 
=====================================================================
Phone: 07805784357
Open Source O/S: http://www.netbsd.org
Caving: http://www.wirralcavinggroup.org.uk
=====================================================================


Home | Main Index | Thread Index | Old Index