NetBSD-Users archive

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

Re: tutorial on how to use iic on raspberry pi?



Not too long ago, in order to get -current to boot, a new .dtb needs to be used.  

# cat config.txt
# Boot options, see https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
#
device_tree=bcm2710-rpi-3-b-plus.dtb
kernel_address=0x01000040
#
# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
#upstream_kernel=1
#uart_2ndstage=1
#
enable_uart=1
force_turbo=0


dtc -I dtb -O dts bcm2710-rpi-3-b-plus.dtb does produce similar output as you mention.

Nonetheless, 
# i2cscan iic0
i2cscan: couldn't open iic0: Device not configured


same for iic1 and iic2


(by they way, why is it i2c in some cases, and iic in others?)

# l -l /dev/iic*
crw-------  1 root  wheel  201, 0 Jun 16  2019 /dev/iic0
crw-------  1 root  wheel  201, 1 Jun 16  2019 /dev/iic1
crw-------  1 root  wheel  201, 2 Jun 16  2019 /dev/iic2


So, for some reason, i2cscan is not finding any i2c bus.

On Wed, Feb 12, 2020 at 1:41 PM Michael van Elst <mlelstv%serpens.de@localhost> wrote:
michael.cheponis%gmail.com@localhost (Michael Cheponis) writes:

-rwxr-xr-x  1 root  wheel  22630 Jun 16  2019 bcm2837-rpi-3-b-plus.dtb*

> Raspberry Pi 3 Model B Plus Rev 1.3 - so I'm not sure which of the
>highlighted dtb files is used.

That one would have i2c enabled. You can disassemble the dtb files with
e.g.

dtc -I dtb -O dts bcm2837-rpi-3-b-plus.dtb

and get something including:

                i2c@7e205000 {
                        compatible = "brcm,bcm2835-i2c";
                        reg = <0x7e205000 0x1000>;
                        interrupts = <0x02 0x15>;
                        clocks = <0x04 0x14>;
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x0e>;
                        clock-frequency = <0x186a0>;
                        linux,phandle = <0x47>;
                        phandle = <0x47>;
                };

                i2c@7e804000 {
                        compatible = "brcm,bcm2835-i2c";
                        reg = <0x7e804000 0x1000>;
                        interrupts = <0x02 0x15>;
                        clocks = <0x04 0x14>;
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;
                        status = "okay";
                        pinctrl-names = "default";
                        pinctrl-0 = <0x16>;
                        clock-frequency = <0x186a0>;
                        linux,phandle = <0x4f>;
                        phandle = <0x4f>;
                };

                i2c@7e805000 {
                        compatible = "brcm,bcm2835-i2c";
                        reg = <0x7e805000 0x1000>;
                        interrupts = <0x02 0x15>;
                        clocks = <0x04 0x14>;
                        #address-cells = <0x01>;
                        #size-cells = <0x00>;
                        status = "okay";
                        linux,phandle = <0x17>;
                        phandle = <0x17>;
                };

--
--
                                Michael van Elst
Internet: mlelstv%serpens.de@localhost
                                "A potential Snark may lurk in every tree."


Home | Main Index | Thread Index | Old Index