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 Michael
El mar, 9 jul 2024 a las 0:38, Michael van Elst (<mlelstv%serpens.de@localhost>) escribió:
>
> ea1abz%gmail.com@localhost (Ramiro Aceves) writes:
>
> >I see that i2c works even if not configured on /boot/config.txt
> >commenting the dtparam=i2c_arm=on:
>
> Yes, that dtparam doesn't exist in our DTB file.
>
> Our DTB file makes all 3 I2C devices available, like:
>
> i2c@7e205000 {
> status = "okay";
> }
>
> i2c@7e804000 {
> status = "okay";
> }
>
> i2c@7e805000 {
> status = "okay";
> }
>
> __symbols__ {
> i2c0 = "/soc/i2c@7e205000";
> i2c1 = "/soc/i2c@7e804000";
> i2c2 = "/soc/i2c@7e805000";
> }
>
> but only i2c@7e804000 should be used.
>
> I usually switch off the other two with an overlay:
>
> /dts-v1/;
> /plugin/;
>
> / {
> compatible = "brcm,bcm2835";
>
> fragment@0 {
> target = <&i2c2>;
>
> __overlay__ {
> status = "disabled";
> };
> };
>
> fragment@1 {
> target = <&i2c0>;
>
> __overlay__ {
> status = "disabled";
> };
> };
>
> fragment@2 {
> target = <&i2c1>;
>
> __overlay__ {
> status = "okay";
> };
> };
> };
>
> Since our device units usually just count up, the remaining one
> is then bsciic0 / iic0 and a program can access it as /dev/iic0.
>
Thank you very much for the information. I think I am starting to
slightly understand all of theese "crazy arm boards". ;-)
I think that using the following:
https://man.netbsd.org/iic.4
https://man.netbsd.org/iic.9
I will be able to interact with any i2c sensor or device I could buy
and connectd to the bus. First I have to re-learn everything about C
programming I learnt in the past. :-) It will be an interesting
exercise.
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.
Home |
Main Index |
Thread Index |
Old Index