iic
Oskar Holmlund
info at ohdata.se
Sat Feb 13 10:08:28 UTC 2021
Hi Elwood,
2021-02-13 03:02 skrev Elwood Downey:
> Hello all!
>
> Trying IIC on RPi 4b 4GB, no joy yet. Looking for ideas. So far:
>
> - bus seems to be present based on dmesg and /dev/iic0 (see below)
> - device is BME280 <https://www.adafruit.com/product/2652> env
> sensor at
> IIC address 0x77.
> - wiki page here <https://wiki.freebsd.org/arm/Raspberry%20Pi>
> suggests
> it should work.
> - The table says "OK (brcm BSC)" but not sure what that extra bit
> means.
> - Tried all the kernels mentioned on that page with no luck so
> decided
> on some 13-BETAs, still no luck.
> - Device is known to work on the same hardware running Raspbian 10
> "buster".
> - tried the I2CRDWR-only test program here
>
> <https://vzaigrin.wordpress.com/2014/04/28/working-with-i2c-in-freebsd-on-raspberry-pi/>
> but that does not find my device either
>
> Suggestions welcome!
>
> adTHANKSvance
>
> Elwood Downey
> Tucson AZ
>
>
> freebsd at generic:~ % dmesg | grep iic
> iichb0: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 26
> on
> simplebus0
> iicbus0: <OFW I2C bus> on iichb0
> iic0: <I2C generic I/O> on iicbus0
>
> freebsd at generic:~ % uname -a
> FreeBSD generic 13.0-BETA2 FreeBSD 13.0-BETA2 #0
> releng/13.0-n244498-6461715f1ae: Fri Feb 12 06:21:00 UTC 2021
> root at releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC
> arm64
>
> freebsd at generic:~ % ls -l /dev/iic0
> crw------- 1 root wheel 0x45 Feb 12 07:01 /dev/iic0
>
> freebsd at generic:~ % sudo i2c -s
> Hardware may not support START/STOP scanning; trying less-reliable read
> method.
> Scanning I2C devices on /dev/iic0: <none found>
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"
- device is BME280 <https://www.adafruit.com/product/2652> env sensor at
IIC address 0x77.
Are you using the "STEMMA QT" interface or have you done the wiring?
If you did the wiring, how?
I dont have any RPI to try myself. But i do have an pocketbeagle with a
mikroe weather click:
https://www.mikroe.com/weather-click
# i2c -s -f /dev/iic1
Hardware may not support START/STOP scanning; trying less-reliable read
method.
Scanning I2C devices on /dev/iic1: 76
In my case I need to apply an device tree overlay[1] to get the i2c1 to
work, not sure if its needed for RPI.
You may check your running devicetree: # sysctl -b hw.fdt.dtb | dtc -I
dtb -O dts > running.dts
I have written a driver for bme280 that I can share after cleaning up.
[1] devicetree overlay for AM3358 (Pocketbeagle, Beagleboneblack:ish
...)
https://github.com/RobertCNelson/bb.org-overlays/blob/master/src/arm/PB-I2C1-WEATHER-CLICK.dts
With modifications:
/*
* Copyright (C) 2017 Robert Nelson <robertcnelson at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
/ {
fragment at 0 {
target = <&am33xx_pinmux>;
__overlay__ {
pb_tl_i2c1_pins: pinmux_pb_tl_i2c1_pins {
pinctrl-single,pins = <
/* (D15) uart1_txd.i2c1_scl */
AM33XX_IOPAD(0x0984,
PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3)
/* (D16) uart1_rxd.i2c1_sda */
AM33XX_IOPAD(0x0980,
PIN_OUTPUT_PULLUP | INPUT_EN | MUX_MODE3)
>;
};
};
};
fragment at 1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pb_tl_i2c1_pins>;
bmp280 at 76 {
compatible = "bosch,bme280";
reg = <0x76>;
bme280,humidity_oversampling=<1>;
bme280,temperature_oversampling=<1>;
bme280,pressure_oversampling=<1>;
bme280,filter=<0>;
bme280,Tstandby=<0>;
};
};
};
};
--
Bästa Hälsningar
Oskar Holmlund
Tel 070-3220292
More information about the freebsd-arm
mailing list