Onewire sensor and pin numbers with the xu4 shifter shield

Post Reply
lgrobe
Posts: 6
Joined: Wed Jul 21, 2021 1:11 am
languages_spoken: English, German, Turkish
ODROIDs: xu4
Has thanked: 3 times
Been thanked: 0
Contact:

Onewire sensor and pin numbers with the xu4 shifter shield

Post by lgrobe »

Dear all,

since I had problems to connect my onewire sensors to the onboard pins, and since I needed a level shifter anyways to interface the 3.3V / 5.0V onewire bus, I installed an odroid xu4 shifter shield. I connected the data line of the sensors (with a pullup resistor toward the power line) to GPX2.0(#24) according to the shield's print (correspondint to the GPIO map at https://odroid.com/dokuwiki/doku.php?id ... ift_shield).

Is this the correct default pin for onewire with the shield?

I am asking since the odroid wiki states that the default on the odroid is "Pin #26 XE.INT16 (GPX2.0)" (https://wiki.odroid.com/odroid-xu4/appl ... gpio/1wire). According to the wiki, I Pin #24 is GPX2.1 (https://wiki.odroid.com/odroid-xu4/soft ... gister_map). So what should I refer to, the numerical GPIO# (24 or 26), or the alphanumeric GPX2.0? I would have tried to connect to GPIO#26 on the shield, but that pin is not available on it.

lsb_release -a is giving me "Ubuntu 20.04.3 LTS". However my sources all point to focal (both ubuntu and armbian sources). This gives me a greeting at login "Welcome to Armbian 21.08.2 Focal with Linux 4.14.222-odroidxu4". I hope that my problems are not due to an incomplete update? I wanted to have the latest Ubuntu as a basis, but could not run the 5.x kernels due to a lack of onewire support.

Best regards, Lars.

User avatar
odroid
Site Admin
Posts: 38352
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2128 times
Been thanked: 1264 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by odroid »

Pin #26 is correct one.
https://wiki.odroid.com/odroid-xu4/appl ... gpio/1wire

Supported latest kernel version is 5.4.142 on our Ubuntu 20.04 LTS image.
https://wiki.odroid.com/odroid-xu4/os_i ... e/20210926

We tested it few months ago.
viewtopic.php?p=332355#p332355
These users thanked the author odroid for the post:
lgrobe (Tue Oct 19, 2021 10:38 pm)

lgrobe
Posts: 6
Joined: Wed Jul 21, 2021 1:11 am
languages_spoken: English, German, Turkish
ODROIDs: xu4
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by lgrobe »

Hi "odroid",

thank you for your answer and the links!

Since Pin #26 is not available with the x4 shifter shield, I will have to make the system attach the onewire stack to a custom pin (e.g. Pin #24). Is this possible without the use of overlays? I would prefer to stay with modprobe, since I am working with headless installations (currently 600km away) and experienced that errors in the overlay configuration left me without access.

Best regards, Lars.

User avatar
mad_ady
Posts: 9974
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 631 times
Been thanked: 780 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by mad_ady »

Yes. You can change the gpios line in the dtb, but the risk is the same as using overlays.
Here's how to calculate what you need to change: viewtopic.php?p=297849#p297849
These users thanked the author mad_ady for the post:
lgrobe (Tue Oct 19, 2021 10:37 pm)

User avatar
odroid
Site Admin
Posts: 38352
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2128 times
Been thanked: 1264 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by odroid »

According to the schematics, XU4 pin #24(XE.INT17) is mapped to Shifter Shield pin #26.
You can find the schematics in the product description page.
https://www.hardkernel.com/shop/xu4-shifter-shield/
These users thanked the author odroid for the post:
lgrobe (Tue Oct 19, 2021 10:37 pm)

lgrobe
Posts: 6
Joined: Wed Jul 21, 2021 1:11 am
languages_spoken: English, German, Turkish
ODROIDs: xu4
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by lgrobe »

Dear all,

it seams that the shield is doing the mapping exactly as expected. So the problem must be somewhere else. One detail I noted is that the state of the pin. According to /sys/kernel/debug/gpio the pin constantly changes its state between high and low (while always being "in"), but is more often high than low.

gpiochip3: GPIOs 24-31, parent: platform/13400000.pinctrl, gpx2:
gpio-24 ( |w1 ) in hi
gpio-25 ( |spi1.1 ) out hi


As far as I understand, the protocol sets the pin to high for some time, than to low just before reading the values. However, it does not detect any sensors (the devices directory shows only the master).

I am operating not in parasitic mode and I have a 4.7K resistor between 5V and pin#24. w1_master_pullup is by default set to 1. Is this correct?

Is it possible that the sensors either draw too much power or that the resistor does not match the cable impedance? I am using one of the level shifter shield's 5V pins to supply power, and I have 5 DS18b20 sensors with TP5 of a total length of about 6m connected. The sensors should draw about 1mA each. I could as well feed the sensors directly with 5V from the power supply, if this is recommended.

What do you recommend how to debug this problem? Do I need to monitor the pin with an oscilloscope, or can I get any further without such equipment?

Best, Lars.

User avatar
mad_ady
Posts: 9974
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 631 times
Been thanked: 780 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by mad_ady »

I'd try the dollowing combinations:
1. powered sensor, short (1m) cable
2. parasite power, short cable
3. powered sensor, long cable
4. parasite power, long cable

I've only tried opyion 1 myself, and has mostly worked well.

User avatar
odroid
Site Admin
Posts: 38352
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2128 times
Been thanked: 1264 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by odroid »

As described in the product page https://www.hardkernel.com/shop/xu4-shifter-shield/
Since this TSX0108E chip is a special bi-directional level shifter which does not have strong output pins that can drive LEDs or long cables.
Start from even shorter 10~20cm wires first to narrow down root causes like mad_ady mentioned.

lgrobe
Posts: 6
Joined: Wed Jul 21, 2021 1:11 am
languages_spoken: English, German, Turkish
ODROIDs: xu4
Has thanked: 3 times
Been thanked: 0
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by lgrobe »

Thank you all for the feed-back! As recommended I will start with a minimalistic setup, connecting one sensor with a resistor between data and 5V and a shorter cable.

I had understood the TSX0108E's limitation as a problem that could be solved by running the bus not in "parasitic mode", so as long as power would be provided by the 5V-pin which should not go through the IC. Has this assumption been wrong?

Best, Lars.

User avatar
odroid
Site Admin
Posts: 38352
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2128 times
Been thanked: 1264 times
Contact:

Re: Onewire sensor and pin numbers with the xu4 shifter shield

Post by odroid »

Test it without "parasitic mode" first.
But, it is not a power issue.
I think TSX0108E has not enough signal output driving capability.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest