DS18B20 OneWire Nano/Xavier

I am trying to run the DS18B20 onewire thermal sensor from a Jetson Xavier. For testing purposes, i am using the jetson nano. We are using jetpack version 4.5.1 due to some other driver dependencies

I followed the following two forum posts:

Based on this, i have made kernel modifications, recompiled and flashed the kernel and device tree.

For the kernel, i have added to the config file

CONFIG_W1_MASTER_GPIO=y
CONFIG_W1=y
CONFIG_W1_SLAVE_THERM=y

This can be checked in /sys/bus where is have aw1 directory

And for the device tree, i have added

onewire@0 {
compatible = “w1-gpio”;
gpios = <&gpio TEGRA_GPIO(H, 4) 0>;
};

This can be checked here: /proc/device-tree i can see: onewire@0

To check if things are working i have used the following python code in python 3.6

from digitemp.master import UART_Adapter
from digitemp.device import AddressableDevice
from digitemp.device import DS18B20

bus = UART_Adapter("/dev/ttyS0") #J44 header name

sensor = DS18B20(bus)

sensor.info()

print(sensor.get_temperature())

i get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/nano/.local/lib/python3.6/site-packages/digitemp/device/thermometer.py", line 275, in __init__
    OneWireTemperatureSensor.__init__(self, bus, rom)
  File "/home/nano/.local/lib/python3.6/site-packages/digitemp/device/thermometer.py", line 32, in __init__
    self.rom_code = self.bus.read_ROM()
  File "/home/nano/.local/lib/python3.6/site-packages/digitemp/master.py", line 245, in read_ROM
    self.write_byte(0x33)
  File "/home/nano/.local/lib/python3.6/site-packages/digitemp/master.py", line 162, in write_byte
    raise AdapterError('Noise on the line detected')
digitemp.exceptions.AdapterError: Noise on the line detected

I am also not sure if my wiring is correct. I have a B01 carrier board on my jetson nano, and I am using both the Rx and Tx from the J50 header and the 3.3V /GND from the J41 header. RX and TX both go to the middle data pin and i have a 4.7k resistor going from the data pin to VCC

I am not sure if the device tree is correct for the jetson nano, but i am not sure what else to specify in the DTS: gpios = <&gpio TEGRA_GPIO(H, 4) 0>;

Have a reference to below link to figure the which GPIO pin.

Thank you for your response.

As mentioned I am currently setting things up on the Jetson Nano. This is because i dont have regular access to a Xavier AGX, and I also cant easily reinstall the AGX.

I also checked the pinout of the nano, and I have problems on either UART pins. The J50 ones seem to be the right pins, because if I use the UART connectors on the J41 header, I receiver a Read/Write error. On the J50 pin, i get a ‘noise on the line’ error.

Below is the link for Nano

I am not sure what to do with this information, As mentioned, I already looked at this, and I tried both UART options on the Jetson Nano B01 board, neither of them working. (pins 8,10 on the J41 and pins 3 and 4 on the J50)

Did you configure the UART by jetson-io?

jetson-io does not have an 1wire modification options for the DS18B20, at least not under jetpack 4.5.1, hence why i did the device tree modifications manually. The only options concerning UART are related to pins 11 and 36, which are not RX or TX.
image

Right, did you confirm the UART function after configure the PINs by jetson-io?
For the one wire need to have correct GPIO define for below.

gpios = <&gpio TEGRA_GPIO(H, 4) 0>;

same error after enabeling the uartb-cts/rts in jetson-io.

As mentioned before, i modified, compiled and flashed the device tree, including the line gpios = <&gpio TEGRA_GPIO(H, 4) 0>; as this can not be done with jetson-io

Could you verify UART function only first.

jetson-io does not offer any other options related to UART. Could you clarify what you mean with “verify UART function first”

Does your UART working? If didn’t please configure the PINS by jetson-io for it.

image
i did enable the uart shown here, and rebooted afterwards. No difference unfortunatly

So UART didn’t work on Nano or Xavier?

Nano, as mentioned above, i can only test this on the Nano on a B01 board. I dont have access to an agx right now.

please also access application note, Jetson Nano Developer Kit 40-Pin Expansion Header GPIO Usage Considerations Applications Note.

This is quite time intensive to implement, so I ended up dropping the sensor. In hindsight, a simple solution is to use a raspberry pi pico, which already supports the DS18B20. This way, you can get the sensor working within a couple of hours and just need to make a serial interface between the agx and the pico. This is not an ideal solution as you now need extra space and power, but this should be manageable for most projects.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.