Skip to content

Connection timed out #385

Closed
Closed

Description

@jurezabkar

Setting a new mode to gyro or ultrasonic sensor, e.g.:

#!/bin/bash

for sen in /sys/class/lego-sensor/*; do
    cat ${sen}/driver_name
    cat ${sen}/port_name
    for m in $(cat ${sen}/modes); do
        echo ${m}
        echo ${m} > ${sen}/mode
    done
done

results in Connection timed out or No such device error:

root@ev3dev:~# ./sensors.sh 
lego-ev3-touch
in4
TOUCH
./sensors.sh: line 8: echo: write error: Invalid argument
lego-ev3-gyro
in1
GYRO-ANG
GYRO-RATE
GYRO-FAS
GYRO-G&A
GYRO-CAL
./sensors.sh: line 8: echo: write error: Connection timed out
lego-ev3-color
in3
COL-REFLECT
COL-AMBIENT
COL-COLOR
REF-RAW
RGB-RAW
COL-CAL
lego-ev3-us
in2
US-DIST-CM
US-DIST-IN
US-LISTEN
US-SI-CM
./sensors.sh: line 8: echo: write error: Connection timed out
US-SI-IN
./sensors.sh: line 8: echo: write error: Connection timed out
US-DC-CM
./sensors.sh: line 8: echo: write error: No such device
US-DC-IN
./sensors.sh: line 8: echo: write error: No such device

For color sensor, setting a new mode always works as expected.

Activity

  1. ddemidov commented on Aug 26, 2015

    @ddemidov
    Member

    See also ddemidov/ev3dev-lang-python#9

  2. dlech commented on Aug 26, 2015

    @dlech
    Member

    The touch sensor is a different error and a different driver, so it needs to be a separate issue.

    IIRC, one or more of the *-CAL modes on the UART sensors need the same note as the IR-S-ALT mode. Setting those modes causes the sensor to reset itself, which would cause errors like those reported.

    However, that shouldn't be happening with the ultrasonic sensor. I'll try to reproduce it when I get a chance.

  3. dlech commented on Sep 6, 2015

    @dlech
    Member

    I've finally set aside some time to look at this. One thing I should have mentioned is to look at the output of dmesg for any hints as to what is going on. This is just a good tip in general.

    As expected, for the LEGO EV3 IR sensor IR-S-ALT mode, in the kernel log, I saw:

    tty ttyS0: Reconnected due to: No data since last keep-alive.
    

    Likewise, I saw the same error for the ultrasonic sensor. At one point though, I got an unexpected result:

    tty ttySU0: Reconnected due to: Unexpected mode.
    

    I also locked up the kernel a few times.


    I put this on my logic analyser to see what was going on. I was able to see that it is the ultrasonic sensor that stops responding and not the EV3. So, I think we can safely say that most of the problem is with the sensor and not our drivers.

    As was already pointed out, this sensor seems to be a bit touchy when it comes to changing modes, particularly when switching from the US-LISTEN mode to another mode (or the same mode).

    It can take up to 5 seconds for a UART sensor to renegotiate, so this explains both write error: Connection timed out and write error: No such device. They just occur at different points during the renegotiation.

    So, I'm going to close this as "wontfix" because the problem is really with the sensors. If I can reproduce the lockup or other error that I saw, I'll open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions