OpenWrt Forum Archive

Topic: ar9331's usb stability issue - [SOLVED]

The content of this topic has been archived between 23 Mar 2017 and 6 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Squonk wrote:

I submitted the patch to the dev list, but it is not yet integrated into either the BB trunk or AA branch.

It is just a matter of days before it will be integrated into BB trunk, then hopefully backported to the AA branch,.

Please be patient!

Hi, I've a similar problem with TL-WR710N. How will we be informed of the integration ?

(Last edited by jmparatte on 27 Jan 2014, 17:17)

nebbia88 wrote:

https://forum.openwrt.org/viewtopic.php … 96#p222296

afaik it's already in trunk, for both ar933x and ar934x cpu's..

Yes it is!

Unfortunately, the stable AA branch is, well... stable smile Nothing yet has been back-ported into it since it changed from development to stable branch in April last year. So chances are slim that this patch will be integrated there.

If you want to have USB running on AR933x/AR934x and you need persistence across "firstboots", the only way is to get BB >= r39212 and compile everything yourself.

Squonk wrote:

Yes it is!

Would you say that the integration is already done in all ar71xx models by the trunk version ?

This morning, i've done a sysupgrade of my TL-WR710N and the problem of my usb serial link to Arduino UNO is the same!

jmparatte wrote:
Squonk wrote:

Yes it is!

Would you say that the integration is already done in all ar71xx models by the trunk version ?

This morning, i've done a sysupgrade of my TL-WR710N and the problem of my usb serial link to Arduino UNO is the same!

https://dev.openwrt.org/changeset/39212

Please check that you are running at least BB r39212!

Tested by several persons in this list on TL-WR703N for several consecutive days without problem.

This is applicable to all ath9k-based SoC.

Squonk wrote:

Please check that you are running at least BB r39212!

BB r39404

What is strange is that Arduino UNO /dev/ttxACMx device is affected but not Arduino 2009 /dev/ttyUSBx device.

How can be affected one kind of USB serial device and not another ?

How do I observe the problem?

I've written a small Arduino program which justs do a special echo, it answers the decimal character code:

void setup() {
  Serial.begin(9600);
}

void loop() {
  int c;
  c = Serial.read();
  if (c != -1) Serial.println(c, DEC);
}

If I use picocom to communicate with Arduino UNO: no problems.
If I use a cgi script which communicates with Arduino UNO: sometimes problems.
I receive sometimes an empty line, sometimes twice responses.
Remark: I've cut the RESET tiny wire between RESET pads of Arduino.

I think the problem is at open/close /dev/ttyACMx, detect EOL.
I observe that sometimes the input buffer is not flushed after close/before open /dev/ttyACMx.
I observe that sometimes the input line is not correctly detected.
I observe that if I replace the line:
  if (c != -1) Serial.println(c, DEC);
by:
  if (c != -1) {
    Serial.print(c / 10);
    delay(100);
    Serial.print(c % 10);
    delay(100);
    Serial.print("\n");
    delay(100);
  }
the result is better.
The result is good if I unplug/plug the Arduino UNO and I send the cgi request after.
I confirm that /dev/ttyUSBx don't have any problems.

There are also another kind of problem with /dev/ttyACMx when I connect a MSP-430EXPG2 or MSP-430F5529.
When opening with picocom, the driver wait a lot of seconds at open/close. And no characters are sent/received.

The CGI SH script:

#!/bin/sh

echo "Cache-Control: no-cache"
echo "Expires: 0"
echo "Access-Control-Allow-Origin: *"
echo "Content-Type: text/plain"
echo ""

device="/dev/ttyACM0"

form_urldecode()
{
    local v
    v="${1//+/ }"
    v="${v//\\%/\\x}"
    echo -e "$v"
}

qs=$QUERY_STRING

while [ ! -z "$qs" ]; do
    p="${qs%%&*}"    # get first part of query string
    k="${p%%=*}"    # get the key (variable name) from it
    v="${p#*=}"    # get the value from it
    qs="${qs#$p*}"    # strip first part from query string
    qs="${qs#&*}"    # strip first part from query string
    eval v="\"`form_urldecode $v`\""
    eval $k="\"$v\""
done

result="#undefined error"

if [ ! -c $device ]; then #not character device ?
    result="#device not ready"
else
if [ -z "$command" ]; then #null command ?
    result="" #set empty result
else
    result="#timeout" #set default result in case of timeout

    set +e
    exec 6<&0 <$device 7>&1 >$device
    echo -n "$command"
    read -t 1 -s result #set result with 1st line (next lines are forgotten)
    exec <&6 6<&- >&7 7>&-
    set -e
fi
fi

echo -n "$result" #output result

How to debug that device problem?

If you help me how to locate the source, I will study it.

(Last edited by jmparatte on 29 Jan 2014, 09:52)

You're welcome wink

rambler wrote:

https://dev.openwrt.org/changeset/39407/

Backported to AA, thanks Rafał & Gabor !

Looking forward to "maintenance release".

If I understand right, it's only a port to AA, not a correction of BB.

Test of BB r39424: Arduino UNO /dev/ttxACMx device is always affected.

BB lives in trunk, patch to the trunk was already commited some time ago (r39212).

jmparatte wrote:
rambler wrote:

https://dev.openwrt.org/changeset/39407/

Backported to AA, thanks Rafał & Gabor !

Looking forward to "maintenance release".

If I understand right, it's only a port to AA, not a correction of BB.

Test of BB r39424: Arduino UNO /dev/ttxACMx device is always affected.

The problem that this patch fixes is an USB complete lock down until the device is unplugged, not a communication problem missing characters if you run CGI and not picocom.

Using this patch with both an Arduino  Duemillanove and a Leonardo (thus /dev/ttyUSBx and /dev/tthACMx devices) works flawlessly for days, compared to hanging between a few minutes and an hour without the patch.

I don't think your problem is addressed by this patch, though it it may reveal an issue in the CDC ACM driver.

can you advice how to install the updates through the web Luci.

guidance would be aprriciated

rgds
Huib

Squonk wrote:

I don't think your problem is addressed by this patch, though it it may reveal an issue in the CDC ACM driver.

Yes, you are right, it's exactly what I think.
The problem occurs when open/close/reopen/... of /dev/ttyACMx and a simple Arduino UNO.
The problem is worst with MSP-430EXP2 and MSP-430F5529 which also work with /dev/ttyACMx.

(Last edited by jmparatte on 3 Feb 2014, 07:57)

Hi

Just a noob question : Does this patch / update allow to use an USB 1.0 device directly on a WR703N (without USB 2.0 hub) ?

I installed the latest (as today) r39692. I'm trying to use a plain USB numeric keypad on my WR703N (with triggerhappy) with no joy. Any packages / insmod required ?

Any help please ? Thanks !

efcis wrote:

Hi

Just a noob question : Does this patch / update allow to use an USB 1.0 device directly on a WR703N (without USB 2.0 hub) ?

I installed the latest (as today) r39692. I'm trying to use a plain USB numeric keypad on my WR703N (with triggerhappy) with no joy. Any packages / insmod required ?

Any help please ? Thanks !

AFAIK, the AR9331 USB OHCI controller does not support low-speed (1.5 MBPS) devices, only full-speed (12 MBPS), while the EHCI controller is 480 MBPS high-speed.

So if your keyboard is only low-speed (USB 1.0 doesn't tell you anything), then you still have to put an external hub in-between.

Merci Squonk

Despite a fresh upgrade with the latest trunk build (r39692) and using a hub, the keypad can't be recognized (same behavior reported on this old ticket). I will open another thread on the forum on this specific topic.

Thanks !

rambler wrote:

https://dev.openwrt.org/changeset/39407/

Backported to AA, thanks Rafał & Gabor !

Looking forward to "maintenance release".

In http://downloads.openwrt.org/attitude_a … x/generic/ and in packages, I don't see any dates more recent than 03-Apr-2013, so what does it mean that serial fix has been "backported"?

If it means that if you build your own AA version complete with all needed packages, it will be fixed, then my question is "How do you do that" (I've often built from trunk, but not from a specific prior revision).

If you only need to build one particular package, or several, how do you do that, and can you replace the old packages in an AA final release installation.

Finally, what revision number is AA, final release: r36088?

(Last edited by lizby on 25 Feb 2014, 22:48)

lizby wrote:
rambler wrote:

https://dev.openwrt.org/changeset/39407/

Backported to AA, thanks Rafał & Gabor !

Looking forward to "maintenance release".

In http://downloads.openwrt.org/attitude_a … x/generic/ and in packages, I don't see any dates more recent than 03-Apr-2013, so what does it mean that serial fix has been "backported"?

If it means that if you build your own AA version complete with all needed packages, it will be fixed, then my question is "How do you do that" (I've often built from trunk, but not from a specific prior revision).

If you only need to build one particular package, or several, how do you do that, and can you replace the old packages in an AA final release installation.

Finally, what revision number is AA, final release: r36088?

As you can see in https://dev.openwrt.org/log/branches/at … adjustment, things are still being “backported” to AA, so that they will be included in a "maintenance release", if it ever happens. (It was sort of planned for August / September 2013, http://wiki.openwrt.org/about/history#a … adjustment, except that nothing is really scheduled in OpenWRT development.)

AA final release is indeed r36088, but you can checkout a later revision of the code, such as

svn co -r 39407 svn://svn.openwrt.org/openwrt/branches/attitude_adjustment

to pick AA 12.09.1 r39407, where the fix was applied, and compile it using your build environment. A “simplified” build procedure, including building only required packages, is described in http://wiki.openwrt.org/doc/howto/easy.build (I never tried it though).

Thanks, Rambler.

In the openwrt directory of my headless Ubuntu build machine, I ran the following:

svn co -r 39407 svn://svn.openwrt.org/openwrt/branches/attitude_adjustment aa_r39407
cd aa_r39407
./scripts/feeds update
./scripts/feeds install -a
make defconfig
make menuconfig
I loaded an old config of mine for the WR703N with serial.

"make V=99" is now running.

This is from old notes.  Anything else needed or recommended?

(Last edited by lizby on 27 Feb 2014, 15:36)

Seems OK, and you are in a position to find out for sure. And post comments?

Ok, that ran to completion and gave me, among others: openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin

I copied that to /var/www on the Ubuntu machine, went to /tmp on the WR703N, DL-ed the file with wget, and flashed it with:

sysupgrade -v openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-sysupgrade.bin

After a couple of minutes I cycled the power and ssh-ed in again and got this:

...  ATTITUDE ADJUSTMENT (Attitude Adjustment, r39407) ...

So all looks good.  I'll try a serial test later.  Then I'll be able to upgrade other WR703Ns.

My next question is:  How do I build all packages as packages so that I can use my Ubuntu machine as a repository and add packages with "opkg update" without having to reflash the whole firmware and re-configure the packages?

Or ... are the AA 12.09 final release packages (other than serial) compatible with this backported firmware?

(Last edited by lizby on 27 Feb 2014, 20:27)

lizby wrote:

My next question is:  How do I build all packages as packages so that I can use my Ubuntu machine as a repository and add packages with "opkg update" without having to reflash the whole firmware and re-configure the packages?

I believe it’s all defined in .config, whether a package is compiled at all, is included in the image (CONFIG_PACKAGE_*=y), or compiled as .ipk (CONFIG_PACKAGE_*=m), see http://wiki.openwrt.org/doc/howto/build#make.menuconfig. In "make menuconfig", there must be somewhere an option to enable all packages, if that’s what you want? Isn’t the default .config building pretty much everything? (I am not really experienced with this.) Otherwise, you can easily compile a single package, such as

 make package/feeds/packages/ffmpeg/compile 

(see http://wiki.openwrt.org/doc/howto/build … e.packages).

Or ... are the AA 12.09 final release packages (other than serial) compatible with this backported firmware?

Not really. While many of them probably are, it may be unwise to "force install" them, especially the kernel modules.

rambler wrote:
lizby wrote:

My next question is:  How do I build all packages as packages so that I can use my Ubuntu machine as a repository and add packages with "opkg update" without having to reflash the whole firmware and re-configure the packages?

I believe it’s all defined in .config, whether a package is compiled at all, is included in the image (CONFIG_PACKAGE_*=y), or compiled as .ipk (CONFIG_PACKAGE_*=m), see http://wiki.openwrt.org/doc/howto/build#make.menuconfig. In "make menuconfig", there must be somewhere an option to enable all packages, if that’s what you want? Isn’t the default .config building pretty much everything? (I am not really experienced with this.)

Check this forum thread: https://forum.openwrt.org/viewtopic.php?id=29619

Basically, remove your .config file and in the "make menuconfig", select the "Global build settings ---> Select all packages by default", then save and exit.

Then launch a "screen" command on the headless build server to be able to reconnect later, and run:

make -j 5 V=99 IGNORE_ERRORS=m BUILD_LOG=1

... where -j 5 depends on how many cores you have on the machine, just use n + 1 (1 master + 4 worker jobs).

rambler wrote:

Or ... are the AA 12.09 final release packages (other than serial) compatible with this backported firmware?

Not really. While many of them probably are, it may be unwise to "force install" them, especially the kernel modules.

No, not at all, especially the kernel modules that contain a hash that depends on the built modules, in order to guarantee that the kernel core and modules have a consistent ABI (Application Binary Interface), i.e. compatible entry points for variables/functions between the different binary object files.

(Last edited by Squonk on 28 Feb 2014, 21:31)

Thanks for the responses.  I had tried "Global build settings ---> Select all packages by default", and then "make V=99", but got only a handful of packages (do I look in "packages" directory).

>remove your .config file

Does this mean I need to remove all "*.config" files from the directory.  I tried "make defconfig" but didn't see that that changed anything.

Anyway, it's running again in a screen with "make -j 2 V=99 IGNORE_ERRORS=m BUILD_LOG=1"  (Atom motherboard, so I know it will take a very long time if it actually does make all packages).

Oops--just finished, so it didn't make all.  bin/ar71xx contains files with this runs date and time.  Here's what was output:

Generating index for package ./libjson_0.11-2_ar71xx.ipk
Generating index for package ./liblua_5.1.4-8_ar71xx.ipk
Generating index for package ./libnl-tiny_0.1-3_ar71xx.ipk
Generating index for package ./libopenssl_1.0.1e-1_ar71xx.ipk
Generating index for package ./libpcap_1.1.1-2_ar71xx.ipk
Generating index for package ./libubox_2013-10-19-734d28eb1a46358743cf8837c91e5d46695c3b91_ar71xx.ipk
Generating index for package ./libubus-lua_2013-08-08-b20a8a01c7faea5bcc9d34d10dcf7736589021b8_ar71xx.ipk
Generating index for package ./libubus_2013-08-08-b20a8a01c7faea5bcc9d34d10dcf7736589021b8_ar71xx.ipk
Generating index for package ./libuci-lua_2013-06-11.1-1_ar71xx.ipk
Generating index for package ./libuci_2013-06-11.1-1_ar71xx.ipk
Generating index for package ./libxtables_1.4.10-5_ar71xx.ipk
Generating index for package ./lua_5.1.4-8_ar71xx.ipk
Generating index for package ./mtd_18.1_ar71xx.ipk
Generating index for package ./netifd_2013-07-16-2674941b06c1ec67f1aff1bff9212e1372106641_ar71xx.ipk
Generating index for package ./opkg_9c97d5ecd795709c8584e972bfdf3aee3a5b846d-3_ar71xx.ipk
Generating index for package ./ppp-mod-pppoe_2.4.5-10_ar71xx.ipk
Generating index for package ./ppp_2.4.5-10_ar71xx.ipk
Generating index for package ./swconfig_10_ar71xx.ipk
Generating index for package ./uboot-envtools_2012.04.01-1_ar71xx.ipk
Generating index for package ./ubus_2013-08-08-b20a8a01c7faea5bcc9d34d10dcf7736589021b8_ar71xx.ipk
Generating index for package ./ubusd_2013-08-08-b20a8a01c7faea5bcc9d34d10dcf7736589021b8_ar71xx.ipk
Generating index for package ./uci_2013-06-11.1-1_ar71xx.ipk
Generating index for package ./uhttpd_2012-10-30-e57bf6d8bfa465a50eea2c30269acdfe751a46fd_ar71xx.ipk
Generating index for package ./wireless-tools_29-5_ar71xx.ipk
Generating index for package ./wpad-mini_20130405-1_ar71xx.ipk
Generating index for package ./zlib_1.2.7-1_ar71xx.ipk
make[2]: Leaving directory `/home/lb/openwrt/aa_r39407'
make[1]: Leaving directory `/home/lb/openwrt/aa_r39407'

So how do I start with a fresh config with which I can select all?