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



Hello Brad,

El 7/7/24 a las 20:40, Brad Spencer escribió:
...
>...
All of the above is probably fine, assuming that the i2c bus is found.
I am not familiar with using that particular dtparam line... and don't
have a RPI0W.  I have never needed anything to enable i2c on the RPI.
You will have to use an overlay to enable SPI..  Be aware that the Linux
overlays (nearly every one of the found on the Internet) probably won't
work with NetBSD.

But the result is the same. Am I missing something?

Ya...  just load the driver ... i.e. put bmx280thp and bmx280thpi2c in
/etc/modules.conf and do modules=YES in /etc/rc.conf and reboot (you can
probably get away with bmx280thpi2c, as the main driver should be a
dependent module and if you have auto loading enabled, it should
load... but you can load it yourself too).  Or... compile up a custom
kernel with the additional config lines you need.. See bmx280thp(4) for
examples of that.


I greatly appreciate your email with the precise instructions to follow. NetBSD community help is marvelous. It is a pleasure to have many expert people ready to help the mediocre users!

Sensor is working fine following your guidelines!

netbsd-raspaZeroW$ cat /etc/modules.conf
bmx280thp
bmx280thpi2c


netbsd-raspaZeroW$ cat /etc/rc.conf |grep module
modules=YES


netbsd-raspaZeroW$ envstat
                 Current  CritMax  WarnMax  WarnMin  CritMin  Unit
[bmx280thp0]
  temperature:    28.260                                      degC
     pressure:   929.880                                       hPa
[vcmbox0]
  temperature:    47.078   85.000                             degC
netbsd-raspaZeroW$

Thank you very much for all!

Regards.
Ramiro.



In the first case, simply loading the drivers, the driver will probe the
i2c bus for something at i2c address 0x76 and 0x77 and see if it is a
BMP280 or BME280.  If so, the driver will attach.  If your chip is at
another address, you will have to use the second way and compile a
kernel telling it what address the chip is at.  It would be unusual for
your chip to NOT be at 0x76 or 0x77.

You may also be able to speak to the chip using SPI if the breakout
board you have brought out the SPI pins.  To do that, wire your board up
as a SPI device and enable SPI for your RPI device.  This may require an
device tree overlay.  Then compile a kernel with the needed config
lines..  see bmx280thp(4) for examples of this.  There are no modules
for SPI.

The BM[PE]280 should work just fine on gpioiic (the bitbanger i2c bus
using gpio pins) too...  just make sure you add pull up resisters to the
SDA and SCL lines.  See gpioiic(4) and gpioctl(8) for examples of how to
attach gpioiic to gpio pins.

Thanks so much.
Ramiro.


I wrote the BM[PE]280 driver and use one all of the time on a RPI0 with
NetBSD 10.x (and 9.x before that).





Home | Main Index | Thread Index | Old Index