[Invalid] - Issues with 1-wire protocol


Osoro

Recommended Posts

Hello there. I have problems with connecting device with 1-wire protocol.

 

Device: DHT11 Temperature-Humidity Sensor - It is Arduino version with pullup on the board.

Board: Orange Pi Zero LTS (H2+)

System: Linux orangepizero 5.10.21-sunxi #21.02.3 SMP Mon Mar 8 00:28:04 UTC 2021 armv7l armv7l armv7l GNU/Linux

 

Based on instructions im preformed some steps:

1) Through armbian-config im enabled w1-gpio 

2) Installed gpio app to get info about ports:

+-----+-----+----------+------+--Orange Pi Zero--+------+----------+-----+-----+
| H2+ | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | H2+ |
+-----+-----+----------+------+---+----++----+---+------+----------+-----+-----+
|     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
|  12 |   8 |    SDA.0 | ALT3 | 0 |  3 || 4  |   |      | 5V       |     |     |
|  11 |   9 |    SCL.0 | ALT3 | 0 |  5 || 6  |   |      | 0v       |     |     |
|   6 |   7 |   GPIO.7 | ALT3 | 0 |  7 || 8  | 0 | ALT3 | TxD3     | 15  | 198 |
|     |     |       0v |      |   |  9 || 10 | 0 | ALT3 | RxD3     | 16  | 199 |
|   1 |   0 |     RxD2 | ALT3 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1   | 1   | 7   |
|   0 |   2 |     TxD2 | ALT3 | 0 | 13 || 14 |   |      | 0v       |     |     |
|   3 |   3 |     CTS2 | ALT3 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4   | 4   | 19  |
|     |     |     3.3v |      |   | 17 || 18 | 0 | ALT3 | GPIO.5   | 5   | 18  |
|  15 |  12 |     MOSI | ALT3 | 0 | 19 || 20 |   |      | 0v       |     |     |
|  16 |  13 |     MISO | ALT3 | 0 | 21 || 22 | 0 | ALT3 | RTS2     | 6   | 2   |
|  14 |  14 |     SCLK | ALT3 | 0 | 23 || 24 | 0 | ALT3 | CE0      | 10  | 13  |
|     |     |       0v |      |   | 25 || 26 | 1 | IN   | GPIO.11  | 11  | 10  |
+-----+-----+----------+------+---+---LEDs---+---+------+----------+-----+-----+
|  17 |  30 | STAT-LED |  OUT | 0 | 27 || 28 |   |      | PWR-LED  |     |     |
+-----+-----+----------+------+---+-----+----+---+------+----------+-----+-----+
| H2+ | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | H2+ |
+-----+-----+----------+------+--Orange Pi Zero--+---+------+---------+-----+--+

3) I have changed /boot/armbianEnv.txt

verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=usbhost2 usbhost3 w1-gpio
rootdev=UUID=d522be3f-9ac0-489b-9d79-500c38e89c86
rootfstype=ext4
param_w1_pin=PA10
param_w1_pin_int_pullup=0
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u

4) Also changed CPU /etc/default/cpufrequtils

ENABLE=true
MIN_SPEED=1400000
MAX_SPEED=1400000
GOVERNOR=interactive

 

As you can see,  im using PA 10 port and i can see at "gpio readall"  value of "V" sign, when im disconnecting wire from board - it is going to be zero, after reconnection it is again going to be 1. Thats showing thats im using correct port.

 

Now im trying to analyze logs at dmesg, and i see this related information, in case loading WITH CONNECTED WIRE

[   12.182141] Driver for 1-wire Dallas network protocol.

[   12.199201] gpio-10 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file

 

In case of DISCONNECTED WIRE LOG WILL BE:

[   12.182141] Driver for 1-wire Dallas network protocol.

[   12.199201] gpio-10 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file

[ 614.571146] w1_master_driver w1_bus_master1: w1_search: max_slave_count 64 reached, will continue next search.

[ 661.463966] w1_master_driver w1_bus_master1: Attaching one wire slave 00.800000000000 crc 8c

[ 661.474854] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.

[ 720.081030] w1_master_driver w1_bus_master1: Attaching one wire slave 00.400000000000 crc 46

[ 720.091987] w1_master_driver w1_bus_master1: Family 0 for 00.400000000000.46 is not registered.

[ 766.913878] w1_master_driver w1_bus_master1: Attaching one wire slave 00.c00000000000 crc ca

[ 766.924868] w1_master_driver w1_bus_master1: Family 0 for 00.c00000000000.ca is not registered.

[ 837.355159] w1_master_driver w1_bus_master1: Attaching one wire slave 00.200000000000 crc 23

[ 837.366059] w1_master_driver w1_bus_master1: Family 0 for 00.200000000000.23 is not registered.

[ 895.996491] w1_master_driver w1_bus_master1: Attaching one wire slave 00.a00000000000 crc af

 

If will connect WIRE again in this case, messages stopping appear.

 

There are no any success with experimenting on changing GPIO port or Device (i have multiple boards and devices) or pullup

 

Core debugging:

After getting all experiments unsuccessful im going and check linux core on driver level.

 

There are function thats making search of connected devices: 

https://github.com/analogdevicesinc/linux/blob/master/drivers/w1/w1.c

 

/**
 * w1_search() - Performs a ROM Search & registers any devices found.
 * @dev: The master device to search
 * @search_type: W1_SEARCH to search all devices, or W1_ALARM_SEARCH
 * to return only devices in the alarmed state
 * @cb: Function to call when a device is found
 *
 * The 1-wire search is a simple binary tree search.
 * For each bit of the address, we read two bits and write one bit.
 * The bit written will put to sleep all devies that don't match that bit.
 * When the two reads differ, the direction choice is obvious.
 * When both bits are 0, we must choose a path to take.
 * When we can scan all 64 bits without having to choose a path, we are done.
 *
 * See "Application note 187 1-wire search algorithm" at www.maxim-ic.com
 *
 */
void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb)

 

On this function im seeing thats search going until dev->max_slave_count will be reached and if no devices found we will see:

dev_info(&dev->dev, "%s: max_slave_count %d reached, ""will continue next search.\n", __func__,dev->max_slave_count);

Everything looks like correct, so we getting error in case of no devices found, but i see the problem thats on next iteration im getting this errors:

[ 766.913878] w1_master_driver w1_bus_master1: Attaching one wire slave 00.c00000000000 crc ca

[ 766.924868] w1_master_driver w1_bus_master1: Family 0 for 00.c00000000000.ca is not registered.

 

Because this errors appear in case of this condition:

		if ( (triplet_ret & 0x03) != 0x03 ) {
			if ((desc_bit == last_zero) || (last_zero < 0)) {
				last_device = 1;
				dev->search_id = 0;
			} else {
				dev->search_id = rn;
			}
			desc_bit = last_zero;
			cb(dev, rn);
		}

on callback function.

 

Based on code research i see thats some "break" on data reading cycle fired or something, thats why im not getting error messages on dmesg in case or WIRE CONNECTED. But w1_master_attempts is increasing, so search cycles going fine

 

Questions:

1) So core is found some device on empty port and trying to connect, how this possible? And why?

2) Why there are no logs in case of connected wire to port but problem with connection? I see debug logs there but i think i need to recompile core to check it.

3) How to make my 1-wire works? :D

Link to post
Share on other sites
Donate and support the project!

Your issue report is not a valid bug report per the Armbian bug reporting instructions (https://www.armbian.com/bugs).  With limited resources the Armbian project is only able to spend time on issues where all the requested information has been provided and for only the boards/images/software that are supported.  Your report is invalid for one or more of the following reasons (non-exhaustive list):

 

  • it is for an unsupported board or image (CSC/EOS/WIP/edge)
  • it is for software that is not supported (such as userspace modules installed on top of the core operating system)
  • it has been logged in the wrong forum (for example requests for help that are not actual bug reports)
  • it lacks requested data (armbianmonitor output)
  • it could have been easily solved by a quick search and/or reading documentation

 

Please review what you have submitted and the bug logging instructions (https://www.armbian.com/bugs) and either add the required information or open a new topic in the correct forum (such as Common issues / peer to peer technical support or General chit chat)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...