DS18B20 temp probe on I2C bus with I2C components

I am writing in C on Debian Linux on a BBB Wireless.
On a custom PCB, I have a Honeywell I2C pressure sensor and a real-time clock on IC2 bus 2 on the BBB (P9_19 & P9_20). These coexist fine.

I goofed on the PCB design though and have a Dallas on-wire temperature probe, DS18B20, output connecting to P9_19 or P9_20 depending on how the one-wire is connected to the board. Either is possible through the connector on the board.

All have the same power supply level - 3.3VDC - and the same ground.

Does anyone know if these can coexist this way? I will definitely change this on the next rev but have 3 boards of this rev and need to get them through our initial testing so software development can start in earnest.

Hi @WalterCEden

So, config-pin does allow this, but really un-tested

Load up both w1-gpio/i2c overlays…

config-pin P9.19 i2c
config-pin P9.20 i2c

Read i2c bus, switch it back to gpio mode for 1w…

config-pin P9.19 gpio

do 1w-gpio read…

Yeah totally untested…

Regards,

@RobertCNelson So, I am able to easily wire my one-wire to P9_24 or P9_26 by using a pad I added to our custom board. In the past, I used P9_12 with the Dallas 1Wire temp probe following an example from @yoder. To use P9_24 I think I need to compile a device tree overlay and load it when the BBB Wireless boots. I made a copy of /opt/source/bb.org/overlays/src/asm/BB-W1-P9.12–00A0.dts and changed the references to P9_12 and gpio1 28 to P9_24 and gpio0 15. I compiled it and changed uEnv.txt to load it at boot time. However, it isn’t loading. The output of version.sh is below along with my dts file for P9_24. I do not work with device tree overlays much and I’m barely a novice so any help will be greatly appreciated!

The version.sh output mentions that pin30 is already requested by ocp:P9_12_pinmux but I don’t know how that relates to using P9_24 for 1Wire and how that request is being made.

Here is my uEnv.txt file

#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0

uname_r=4.19.94-ti-r68
#uuid=
#dtb=

###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=<file0>.dtbo
#uboot_overlay_addr1=<file1>.dtbo
#uboot_overlay_addr2=<file2>.dtbo
#uboot_overlay_addr3=<file3>.dtbo
###
###Additional custom capes
uboot_overlay_addr4=/lib/firmware/BB-W1-P9.24-00A0.dtbo
#uboot_overlay_addr5=<file5>.dtbo
#uboot_overlay_addr6=<file6>.dtbo
#uboot_overlay_addr7=<file7>.dtbo
###
###Custom Cape
#dtb_overlay=<file8>.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
#disable_uboot_overlay_wireless=1
#disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
#uboot_overlay_pru=AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###  
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###

cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet overlayroot=tmpfs

##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

version.sh output follows here

git:/opt/scripts/:[e4e4854ef8ff9ada5c85553376043ee7679167ca]
eeprom:[A335BNLTBWA52027BBWG0227]
model:[TI_AM335x_BeagleBone_Black_Wireless]
dogtag:[BeagleBoard.org Debian Buster IoT Image 2021-02-15]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot SPL 2019.04-00002-gc9b3922522 (Aug 24 2020 - 16:42:18 -0500)]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-gc9b3922522]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0.kernel]
UBOOT: Loaded Overlay:[BB-ADC-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BBBW-WL1835-00A0.kernel]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.kernel]
UBOOT: Loaded Overlay:[BB-W1-P9.24-00A0.bb.org-overlays]
kernel:[4.19.94-ti-r68]
nodejs:[v10.23.1]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/BB-W1-P9.24-00A0.dtbo]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[disable_uboot_overlay_audio=1]
uboot_overlay_options:[uboot_overlay_pru=AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.14.20210809.0-0~buster+20210816]
pkg:[bb-customizations]:[1.20210810.1-0~buster+20210810]
pkg:[bb-usb-gadgets]:[1.20200504.0-0~buster+20200504]
pkg:[bb-wl18xx-firmware]:[1.20200813.1-0~buster+20200813]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.5-git20200715.0-0~buster+20200716]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal input bluetooth netdev i2c gpio admin spi iio docker tisdk weston-launch xenomai cloud9ide pwm eqep remoteproc]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
dmesg | grep remote
[   55.868217] Bluetooth: hci0: change remote baud rate command in firmware
[   74.369863] remoteproc remoteproc0: wkup_m3 is available
[   74.413046] remoteproc remoteproc0: powering up wkup_m3
[   74.413077] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217148
[   74.413366] remoteproc remoteproc0: remote processor wkup_m3 is now up
[   77.751819] remoteproc remoteproc1: 4a334000.pru is available
[   77.754156] remoteproc remoteproc2: 4a338000.pru is available
dmesg | grep pru
[   77.751819] remoteproc remoteproc1: 4a334000.pru is available
[   77.751980] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
[   77.754156] remoteproc remoteproc2: 4a338000.pru is available
[   77.754332] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
dmesg | grep pinctrl-single
[    1.026239] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[   74.236032] pinctrl-single 44e10800.pinmux: pin PIN30 already requested by ocp:P9_12_pinmux; cannot claim for onewire
[   74.391769] pinctrl-single 44e10800.pinmux: pin-30 (onewire) status -22
[   74.484320] pinctrl-single 44e10800.pinmux: could not request pin 30 (PIN30) from group pinmux_bb_dallas_w1_pins  on device pinctrl-single
dmesg | grep gpio-of-helper
[    1.039239] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

BB-W1-P9.24-00A0.dts follows:


// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
 * Virtual cape for onewire on connector pin P9.24
 *
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
        overlays {
                BB-W1-P9.24-00A0.bb.org-overlays = __TIMESTAMP__;
        };
};

/*
 * Free up the pins used by the cape from the pinmux helpers.
 */SPDX-License-Identifier: GPL-2.0-only
&ocp {
        P9_24_pinmux { status = "disabled"; };  /* P9_24 (D15) gpmc_be1n.gpio0_15 */
}; Virtual cape for onewire on connector pin P9.24
 *
&am33xx_pinmux {
        bb_dallas_w1_pins: pinmux_bb_dallas_w1_pins {
                pinctrl-single,pins = <
                        AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE7)       /* P9_24(D15) gpmc_be1n.gpio0_15 */
                >;
        };dt-bindings/gpio/gpio.h>
};nclude <dt-bindings/pinctrl/am33xx.h>

&{/} {
        onewire { loaded overlays under: /proc/device-tree/chosen/overlays/
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&bb_dallas_w1_pins>;
                BB-W1-P9.24-00A0.bb.org-overlays = __TIMESTAMP__;
                compatible = "w1-gpio";
                gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
        };
};

This ‘disables’ config-pin for that pin…

Remember you are in an odd situation, so other users ignore this… :wink:

Drop ocp and am33xx_pinmux settings and just use:

&{/} {
        onewire {
                status = "okay";
                compatible = "w1-gpio";
                gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
        };
};

PS, your copy/paste is corrupt…

Regards,

Sorry about the corruption…

So is this what you are suggesting the entire BB-W1-P9.24-00A0.dts file should consist of?

/ SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
 * Virtual cape for onewire on connector pin P9.24
 *
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
        overlays {
                BB-W1-P9.24-00A0.bb.org-overlays = __TIMESTAMP__;
        };
};

&{/} {
        onewire {
                status = "okay";
                compatible = "w1-gpio";
                gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
        };
};

Sorry, @WalterCEden got confused, didn’t read that you moved the pin… The real issue…

[   74.236032] pinctrl-single 44e10800.pinmux: pin PIN30 already requested by ocp:P9_12_pinmux; cannot claim for onewire
[   74.391769] pinctrl-single 44e10800.pinmux: pin-30 (onewire) status -22
[   74.484320] pinctrl-single 44e10800.pinmux: could not request pin 30 (PIN30) from group pinmux_bb_dallas_w1_pins  on device pinctrl-single

Looking at:

&am33xx_pinmux {
        bb_dallas_w1_pins: pinmux_bb_dallas_w1_pins {
                pinctrl-single,pins = <
                        AM33XX_PADCONF(AM335X_PIN_GPMC_BEN1, PIN_INPUT_PULLUP, MUX_MODE7)       /* P9_24(D15) gpmc_be1n.gpio0_15 */
                >;
        }

AM335X_PIN_GPMC_BEN1 → #define AM335X_PIN_GPMC_BEN1 0x878#define BONE_P9_12 0x078

so you have the wrong pin, for P9_24: #define BONE_P9_24 0x184#define AM335X_PIN_UART1_TXD 0x984

/ SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2015 Robert Nelson <robertcnelson@gmail.com>
 * Virtual cape for onewire on connector pin P9.24
 *
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/*
 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
 */
&{/chosen} {
        overlays {
                BB-W1-P9.24-00A0.bb.org-overlays = __TIMESTAMP__;
        };
};

/*
 * Free up the pins used by the cape from the pinmux helpers.
 */
&ocp {
        P9_24_pinmux { status = "disabled"; };
};

&am33xx_pinmux {
        bb_dallas_w1_pins: pinmux_bb_dallas_w1_pins {
                pinctrl-single,pins = <
                        AM33XX_PADCONF(AM335X_PIN_UART1_TXD, PIN_INPUT_PULLUP, MUX_MODE7)
                >;
        };
};

&{/} {
        onewire {
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&bb_dallas_w1_pins>;
                compatible = "w1-gpio";
                gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
        };
};

Ref:

1 Like

Well, duh. I shouid have caught that. I had checked the include files but didn’t notice this difference in the dts. I changed it and everything is working fine now. I generally reference the header tables in the SRM rev c.1 and they don’t include the pin addresses like the one in Molloy’s repo. I’ll remember to check that going forward. Thank you very much for all your help with this!