NetBSD-Users archive

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

Re: I cannot make i2c work in raspberry pi Zero W



Ramiro Aceves <ea1abz%gmail.com@localhost> writes:

[snip]

> Just a probably silly question: If I want to read the sensor that is
> being used by the bmh280thp driver, should I stop the driver first or
> the sensor can be inquired by the driver and my program ?
>
> Regards.
> Ramiro.


That question is device and driver dependent, but just speaking
generally, you would not want the kernel driver present if you are
messing with the device from userland.  If you used modules, simply
unload it, or don't load it in the first place.  You can probably also
use 'drvctl -d <device>' to detach the driver.  For the Bosch 280
devices, you can probably get away with not doing this, as there is very
little set up that the kernel driver does and there isn't any sort of
periodic update mode that is used that might have a kernel thread
polling the device.  As long as you didn't try running envstat at the
same time you were messing with the device from userland, you may be
fine.  The kernel driver only holds a i2c lock on the device when it is
doing a i2c read or write.


On the BM[EP]280 device itself....  depending on what you are trying to
actually do...  there are chip specific values that much be read out of
each chip individually and used in the raw value -> usable value
conversion routines.  These values are factory set and unique to each
chip.  You can look at the source for the kernel driver and see how
these values are pulled out of the chip in the attach function.  To get
a usable output you need these calibration values and the conversion
algorithm which is published in the Bosch data sheet in order to get a
usable values from the sensor.  All other drivers for other devices,
like the Ardunio, will do something simular.  The Bosch 280 is more
complicated in this respect then most of the devices it competes with in
that the consumer of the device's raw output must apply chip specific
calibration when converting the raw values to something useable.





-- 
Brad Spencer - brad%anduin.eldar.org@localhost - KC8VKS - http://anduin.eldar.org



Home | Main Index | Thread Index | Old Index