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.

the only solution so far is to use a different SoC.  the 5350 is currently my favorite.  Both USB 1.1 and USB 2.0 works perfectly on them.  I really like the poray routers.  Take a look at the M4.  Runs OpenWrt like a dream has 8M flash and 32M RAM with a mips architecture running at 360 Mhz.

--luis

Only problem is that I have around 600 TP-link MR3020 routers already tongue

I asked around and got two tips that I will try out.

Disconnecting the +5V in the usb cable.

Changing two 0 ohm resistors on the usb A and B line from 0 ohm to 33 ohm and soldering two 4pF capacitors on the A and B line to ground on the chip.

Did I get that right, you want to do this mod 600 times? %-)

God no wink But solving the problem usually gives more insight into the problem. And maybe that brings us an easier solution.
And for the people that work with a few boxes adding some components on the chip might be easier than adding a usb hub internally.

Cutting the vcc (5+) line of the usb cable has the effect that it can't open the serial port at all.

(Last edited by peteruithoven on 22 Aug 2013, 10:08)

Ttake a look at this commit in 8devices Carambola2 repository:
https://github.com/8devices/carambola2/ … 5c4e168923

It seems that it solves problems with USB 1.1 devices connected to AR9331 USB host:

"When wifi radio is reset, some bits in (undocumented) USB registers may flip. Patch adds setting them after radio reset (channel change, up/down). With this patch stability of USB1.1 full-speed devices, connected directly to AR9331 host port (no USB2.0 hub) is improved."

(Last edited by pepe2k on 14 Dec 2013, 16:21)

pepe2k wrote:

Ttake a look at this commit in 8devices Carambola2 repository:
https://github.com/8devices/carambola2/ … 5c4e168923

It seems that it solves problems with USB 1.1 devices connected to AR9331 USB host:

"When wifi radio is reset, some bits in (undocumented) USB registers may flip. Patch adds setting them after radio reset (channel change, up/down). With this patch stability of USB1.1 full-speed devices, connected directly to AR9331 host port (no USB2.0 hub) is improved."

that's a good news,i going to do the test for the wr703,

Has anyone tried this patch yet?


slboat wrote:
pepe2k wrote:

Ttake a look at this commit in 8devices Carambola2 repository:
https://github.com/8devices/carambola2/ … 5c4e168923

It seems that it solves problems with USB 1.1 devices connected to AR9331 USB host:

"When wifi radio is reset, some bits in (undocumented) USB registers may flip. Patch adds setting them after radio reset (channel change, up/down). With this patch stability of USB1.1 full-speed devices, connected directly to AR9331 host port (no USB2.0 hub) is improved."

that's a good news,i going to do the test for the wr703,

Not yet!

I'll try ASAP.

been running ppp on a hornet-ap121u for about an hour now... and working well so far... will run overnight and report back.

--luis

(Last edited by lsoltero on 15 Dec 2013, 21:04)

i start test first 3 routes,this just normal test,without any patch,just make sure them can been brick usb,so we can compare it does work

http://farm6.staticflickr.com/5544/11397005684_9516ff80f8_c.jpg

and give them a mark, them are [SL.M230],[SL.M245],[SL.M230]

http://farm4.staticflickr.com/3711/11397038424_927edeecc9_c.jpg

start test time: 13:03 <- maybe this a bad idea,not use time,i use the squonk's way by the arduino's ticket

without patch test
M230
Test #1: Dead on 49 second
Test #2: Dead on 254 second
Test #3: Dead on 555 second
Test #4: Dead on 546 second
Test #5: Dead on 212 second
Test #6: Dead on 120 second
Test #7: Dead on 662 second
Test #8: Dead on 96 second
Test #8: Dead on 58 second
M245
Test #1: Dead on 817 second
Test #2: Dead on 124 second
Test #3: Dead on 187 second
Test #4: Dead on 92 second
M250
Test #1: Dead on 835 second

the m230 is very often to dead,so it should be have good chance see what change,now i compile the package for it..

still comiple,i direct use the carambola2 source to make for wr703
http://see.sl088.com/w/images/4/4f/ClipCapIt-131216-171134.PNG

(Last edited by slboat on 16 Dec 2013, 10:10)

slboat wrote:
pepe2k wrote:

Ttake a look at this commit in 8devices Carambola2 repository:
https://github.com/8devices/carambola2/ … 5c4e168923

It seems that it solves problems with USB 1.1 devices connected to AR9331 USB host:

"When wifi radio is reset, some bits in (undocumented) USB registers may flip. Patch adds setting them after radio reset (channel change, up/down). With this patch stability of USB1.1 full-speed devices, connected directly to AR9331 host port (no USB2.0 hub) is improved."

that's a good news,i going to do the test for the wr703,

Thank you very much for the information.
Using this patch, my AR9331 board can connect to a USB1.1 FTDI serial cable directly, and the serial communication is stable for several hours long term test.

I guess the reasons mentioned by others in this topic does't cause usb hang issue, and I believe the really reason is AR9331's hardware bug.

Hope others try this patch and maybe your will find out your issue dissapeared.
https://github.com/8devices/carambola2/ … 5c4e168923

Hello All,

been running test here for about 18 hours now without issue. So it seems that this patch has addressed my problem (as well as that for others).  What is interesting is that we were very close about a year ago!  Here is a comment made to me by @squonk

-----
BTW, this " WAR_USB_DISABLE_PLL_LOCK_DETECT()" patch is the same thing that was done in QCA's Open HAL here:
https://github.com/qca/qcamain_open_hal … eset.c#L76

I reported it in the forum:
https://forum.openwrt.org/viewtopic.php … 28#p197328

It looks very much like what was also suspected by @mips 1 year ago:
https://forum.openwrt.org/viewtopic.php … 31#p182631

The only difference is when this macro is called: we did not put it everywhere it was required...
-----

so... it seems that were very close but did not persist enough...

for those wanting to test this patch against the latest BB distribution just drop file this into

packages/mac80211/patches/566-ath9k_usb_hang_workaround.patch

Thanks to @squonk for providing this....

--- a/drivers/net/wireless/ath/ath9k/hw.c    2013-11-29 20:12:03.000000000 +0100
+++ b/drivers/net/wireless/ath/ath9k/hw.c    2013-12-15 17:20:40.727254556 +0100
@@ -35,6 +35,16 @@
MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
MODULE_LICENSE("Dual BSD/GPL");

+#define WAR_USB_DISABLE_PLL_LOCK_DETECT(_ah) \
+do { \
+    if (AR_SREV_9330(_ah) || AR_SREV_9340(_ah)) { \
+        volatile u_int32_t *usb_ctrl_r1 = (u_int32_t *) 0xb8116c84; \
+        volatile u_int32_t *usb_ctrl_r2 = (u_int32_t *) 0xb8116c88; \
+        *usb_ctrl_r1 = (*usb_ctrl_r1 & 0xffefffff); \
+        *usb_ctrl_r2 = (*usb_ctrl_r2 & 0xfc1fffff) | (1 << 21) | (3 << 22); \
+    } \
+} while (0)
+
static int __init ath9k_init(void)
{
    return 0;
@@ -1390,6 +1400,8 @@
    if (AR_SREV_9100(ah))
        udelay(50);

+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+
    return true;
}

@@ -1490,6 +1502,8 @@
        ar9003_hw_internal_regulator_apply(ah);
    ath9k_hw_init_pll(ah, chan);
    ath9k_hw_set_rfmode(ah, chan);
+   
+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);

    return true;
}
@@ -1841,8 +1855,11 @@
    if (AR_SREV_9271(ah))
        ar9002_hw_load_ani_reg(ah, chan);

+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+
    return 0;
fail:
+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
    return -EINVAL;
}

@@ -2052,6 +2069,8 @@
    if (AR_SREV_9565(ah) && ah->shared_chain_lnadiv)
        REG_SET_BIT(ah, AR_BTCOEX_WL_LNADIV, AR_BTCOEX_WL_LNADIV_FORCE_ON);

+    WAR_USB_DISABLE_PLL_LOCK_DETECT(ah);
+
    return 0;
}
EXPORT_SYMBOL(ath9k_hw_reset);

hi lsoltero,could you compile a wr703 bin file,so i can test on the wr703,the compile of me,is still on....slowly old machine,just not get speed on it

never mind,the compile has done,but is night now,test on tomorrow:)
i try publish it for other guy test

here is the firmware for now,with the patch and base package(kmod-usb-acm for arduino uno,microcom for watch the serial):
http://pan.baidu.com/s/1CI2UZ

i start test first 3 device,as so far,everything work well
http://see.sl088.com/w/images/6/65/JustCapIt9847.jpg

and if you do the test with this firmware,plz enable wifi first,and you can use [microcom -s 57600 /dev/ttyACM0]kind as start..

(Last edited by slboat on 17 Dec 2013, 10:58)

I just passed the 100 000 mark, meaning my Arduino board is sending 1 second period counts to the TL-WR703N (connected directly) for 27:46:40!

This patch is working like a Swiss cuckoo clock!

I think we can consider this issue as closed!

Thanks everybody!

Does "closed" mean it will be pushed to trunk and maybe backported to AA?

Hi,

I use a MR3020 router with an usb audio card. The audio card is recognized as 1.1. If I use the wifi, it usually reboots itself after some minutes. There's no auto-reboot when having the wireless radio turned off.
So, do you think this patch will allow me to use the wireless radio and the usb audio card? I ask so I don't build the entire toolchain in vain.

Thank you very much to all for keep looking and searching throughout all this time!

i think there is a good chance that it will work.  Everyone else who has corresponded states that their problems have vanished.  If your USB problems are tied to the WiFi then there ia very good chance that you are having the same issue as everyone else.  Unfortunately there is only one way to find out.

good luck.

--luis

Hi all guys:

Good news,so the AR9331 is really a good toy for us if we can fix this issue.
Let's do more interesting things base on it.

3 device work very well
http://see.sl088.com/w/images/c/c1/JustCapIt9848.jpg

Great done!

I'm still waiting for my wr703, so i have time to read a lot, specially this thread.

Great to hear that this USB 1.1 problem is solved, but how can we apply this patch
to the latest AA?
Do we have to compile our own version with this patch? or is it possible to run some
sort of file to apply the patch?

Sorry for my Noob question


Grtzz  Mark

I will prepare a patch for the latest AA branch tonight and submit it for backport to the mailing list, so the automatically-generated images will contain the patch.

In the meantime, you will have to copy the patch file into the devel tree and compile your own, hopefully not for a long time!

if you wana just for do a quick test but not want to compile it,you can try the camarala version for wr703
http://pan.baidu.com/s/1CI2UZ

my test is base on this version,and it still going...

http://see.sl088.com/w/images/5/5f/JustCapIt9857.jpg

i think them are sth still could be test,like is the wifi is stabile,if have the usb but lost the wifi stabile that's be very sad

(Last edited by slboat on 17 Dec 2013, 11:02)

As far as I can tell ,this patch doesn't affect the WiFi stability: it only sets some magic bits in the USB controller when the WiFi is reset/changed channel.

I will prepare a patch for the latest AA branch tonight and submit it for backport to the mailing list, so the automatically-generated images will contain the patch.

In the meantime, you will have to copy the patch file into the devel tree and compile your own, hopefully not for a long time!

Many! thanks for the work and the drive to solve this problem (from reading i understand that Atheros knows the problem but don't want to solve it)
For my understanding, this patch sets some bits from the USB controller registers (here the USB PLL) which are not set the right way at initialize (boot) but change when you switch off the WiFi?

Looking forward for the patched AA

Grtzz  Mark