Replies: 2 comments 1 reply
-
Hi @maxkraft7, The zephyr,serial 1-Wire driver itself does not assume a specific connection, and hence it requires the user to configure the GPIOs to match the used hardware. The driver outputs logic low via the TX pin to pull down the Bus and reads the bus level via the RX pin. So yeah, the connection you have linked is expected to work. Have you configured the TX pin with open-drain drive? |
Beta Was this translation helpful? Give feedback.
-
I'm using it on a nrf9160 feather designed by circuitdojo (specs here). The overlay I adapted from the existing sample code. I'm using it on UART2. With this overlay: one_wire_serial: &uart2 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart2_default>;
pinctrl-1 = <&uart2_sleep>;
pinctrl-names = "default", "sleep";
};
&one_wire_serial {
status = "okay";
w1_0: w1-zephyr-serial-0 {
compatible = "zephyr,w1-serial";
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
testlabel: ds18b20 {
compatible = "maxim,ds18b20";
family-code = <0x28>;
resolution = <12>;
status = "okay";
};
} I would prefer to use it via the GPIO Pins but the Zephyr derivate for this board (see their fork) doesn't have the GPIO-capabilities of the DS18B20 driver available yet. I've had limited success retreiving the unique Id of each sensor using the w1-scanner sample. But when I attempt to read the temperature I only get 85°C. According to the docs mentioned in my last message this indicates that the value has not yet been retrieved. If I plug the same wires into an Arduino with an ordinary DS18B20 libary it works with ease. There I use a GPIO wiring though. Edit: Regarding the open drain, this is my pinctrl: &pinctrl {
uart2_default: uart2_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 24)>;
bias-pull-up;
};
group2 {
psels = <NRF_PSEL(UART_RX, 0, 23)>;
/* max. 5mA drive strength: */
nordic,drive-mode = <NRF_DRIVE_H0D1>;
};
};
}; |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
How do I have to wire the DS18B20 when using it on a UART connection? When I do it as descibed here: https://www.analog.com/media/en/technical-documentation/data-sheets/ds18b20.pdf (page 10, bottom) the 1wire driver is in a constant reset-state. All the instructions on the web describe how to do it with a GPIO pin.
Environment
samples/sensor/ds18b20/README
Beta Was this translation helpful? Give feedback.
All reactions