gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: USB redux

Thu Jan 03, 2013 4:12 pm

OK,

But what I'm trying to ascertain is whether the problem is fixed by unplugging / replugging the keyboard (i.e. hot-plugging the keyboard whilst still running....)

I want to know if the issue you are seeing can be made to go away by re-enumerating the USB device

Gordon
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

exabrial
Posts: 13
Joined: Mon Nov 26, 2012 11:57 pm

Re: USB redux

Thu Jan 03, 2013 6:16 pm

I'm having problems with WiFi I suspect are related to USB. I've done the normal fixes (get a powered hub, try a different card, mess endlessly with your router and wireless) and the raspberrypi is the only device suffering on my network. I certainly don't want to impede the progress on this thread, but if you think my input and troubleshooting would be valuable let me know how I can help out.

Original post:
http://www.raspberrypi.org/phpBB3/viewt ... 6&p=249720

Thank you for working on the USB issues!

tmpp
Posts: 8
Joined: Sun Dec 02, 2012 5:26 pm
Location: Chicago

Re: USB redux

Thu Jan 03, 2013 6:31 pm

Oops, my bad, I will do the same for USB plug. Results soon.

tmpp
Posts: 8
Joined: Sun Dec 02, 2012 5:26 pm
Location: Chicago

Re: USB redux

Thu Jan 03, 2013 7:04 pm

I'll read closer next time, pulls to the USB Dell kbd was done to the same socket.
I am a reasonable typist but you can see in the listing that the skips and repeats are evident.

Code: Select all

after power plug pull
trial number 1

abcdefghijklllllllllmmmmmnopqurstvwxyyyyyyyyyyyyyz12344567890-= (yes misbehaviour)
abcdefghijklmnopqurtuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial number 2 after usb pull
abdcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz123456890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial number 3 after usb pull
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial number 4 after usb pull
abdcefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

after a power plug pull
trial number 5 
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial number 6 after usb pull
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijkmnopqrrrrrstuwxyz1234567890-
abcdefghijklmnopqrstuvwxyzzzz123456789990-= ( yes misbehaviour)
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdeghijklmnopqrstuvwxyz12345678890-=
abcdddefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial           number 8 afte s    ll    (yes misbehaviour)
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial after power pull not usb
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=

trial after usb pull                    (text is good but had to struggle with cmdline nano filename)
abcdefgghijklmnopqrstuvwxyz1234567890-=
abcedfghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefghijklmnopqrstuvwxyz1234567890-=
abcdefgjijklmnopqrstuvwxy

tral fterusb ull ( caused the previous txt to be ovewritten with BS. )

abcdefgjijmnopqrrstuvwxyz23456789-
abcdefghhijklmnopqrstuvwxyz1234678990-=
abcddefghiiijklmnopqrtuvwxz1234567890-=
abcdfghiijjjjjjjjklllmnopqrstuvwxyz123467890-=

User avatar
scrishton
Posts: 49
Joined: Mon May 07, 2012 8:48 pm
Location: Settle, in the Yorkshire Dales
Contact: Website

Re: USB redux

Fri Jan 04, 2013 7:16 pm

I have been working on a USB to serial project on the RasPi for some months now, with quite a lot of success. However, later versions of the operating system seem to give more problems. With an early version of Raspbian, 3.1.9 #168 from 14th July, I can reliably open and read/write twelve RS422 serial ports. These are on three FTDI USB-COM422-PLUS4 cards. I have used the system at my day job to control banks of video recorders, and have left the system talking to itself on another RasPi for days on end without problems. However, with updated versions of Raspbian I can only use one 4-port card at a time. If I open more than one card the keyboard stops responding.

I am also trying to get my system to work with a Contour Shuttle Xpress USB jog and shuttle wheel. By opening and reading the /dev/input/event file and reading 16 bytes at a time from it I can get the input to work, but it stops me from opening any USB serial ports on 3.1.9. If I open the serial ports first, I cannot open the event file. On the up to date OS I can read the Shuttle Xpress and open a 4 port serial device. But then I can only open one serial device.

Simon R.

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: USB redux

Sun Jan 06, 2013 10:20 pm

scrishton wrote:However, with updated versions of Raspbian I can only use one 4-port card at a time.
Tried kernel 3.6.y yet via https://github.com/Hexxeh/rpi-update ?
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

M_P
Posts: 51
Joined: Sun Jan 06, 2013 5:40 pm

Re: USB redux

Mon Jan 07, 2013 12:22 am

Hello there,

I hope this is the right place to post this - please accept my apologies if it isn't.

I've been reading the various USB-related threads and thought I'd post some of my experiences so far, maybe the information will be useful to someone. I picked up a couple of RPis about a week ago, mainly to replace an old Sheevaplug that is on its last legs but they've been a blast to work with so far!

I have three webcams - a Logitech C600 and two Microsoft LifeCam Cinema. Up until last night, I was unable to get anything better than 640x480 resolution on either of them using the "motion" package, and even then it would suddenly fail and I would lose all connectivity. Last night, I ran rpi-update and was suddenly able to capture at 960x544 using the LifeCam. I left it run overnight and in the morning I was still able to access the RPi, although the camera was no longer working. I am able to replicate the issue on both LifeCams and with two RPIs.

Updating made a huge improvement - the fact that I can still access the RPi after there's a problem is fantastic!

The camera, however, is not enumerated again until it is disconnected and reconnected or power is removed from the whole system - a reboot does not bring it back. The camera (USB) seems to fail now with the following message:

Jan 6 09:24:00 upfront kernel: [22757.024619] hub 1-0:1.0: port 1 disabled by hub (EMI?), re-enabling...

I have a powered Staples-brand hub which is apparently a rebranded Belkin but I can't figure out the exact model number.

uname -a (original): 3.2.27+ #250 PREEMPT Thu Oct 18 19:03:02 BST 2012

uname -a (after rpi-update): 3.6.11+ #348 PREEMPT Tue Jan 1 16:33:22 GMT 2013

I've pulled the cover off of my scope and will play around, see if I can get some more information. I'm not sure if the EMI message is legit, but I've got a roll of aluminum foil and I'm going to spend some time shielding the heck of out things to see if it makes a difference.

But again - big improvement in performance with the update!

If there's anything in particular that I should try to gather useful information, please let me know!

kermitas
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am

Re: USB redux

Mon Jan 07, 2013 7:29 am

M_P wrote:Hello there,
I have three webcams - a Logitech C600 and two Microsoft LifeCam Cinema.
...
The camera, however, is not enumerated again until it is disconnected and reconnected or power is removed from the whole system - a reboot does not bring it back. The camera (USB) seems to fail now with the following message:

Jan 6 09:24:00 upfront kernel: [22757.024619] hub 1-0:1.0: port 1 disabled by hub (EMI?), re-enabling...
...
I'm not sure if the EMI message is legit, but I've got a roll of aluminum foil and I'm going to spend some time shielding the heck of out things to see if it makes a difference.
Hello M_P,

during 3 months of 2012 summer holidays almost every day I was fighting with the same problem, please see here http://www.raspberrypi.org/phpBB3/viewt ... 67#p146067 .

You should see there my metal box and EMI filters - it didn't help. Don't waste your time and money as I do.

Today I should receive MK808 and I hope that I will be able to work with two FullHD webcams - we will see.

Arthur

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23709
Joined: Sat Jul 30, 2011 7:41 pm

Re: USB redux

Mon Jan 07, 2013 8:30 am

kermitas wrote:
M_P wrote:Hello there,
I have three webcams - a Logitech C600 and two Microsoft LifeCam Cinema.
...
The camera, however, is not enumerated again until it is disconnected and reconnected or power is removed from the whole system - a reboot does not bring it back. The camera (USB) seems to fail now with the following message:

Jan 6 09:24:00 upfront kernel: [22757.024619] hub 1-0:1.0: port 1 disabled by hub (EMI?), re-enabling...
...
I'm not sure if the EMI message is legit, but I've got a roll of aluminum foil and I'm going to spend some time shielding the heck of out things to see if it makes a difference.
Hello M_P,

during 3 months of 2012 summer holidays almost every day I was fighting with the same problem, please see here http://www.raspberrypi.org/phpBB3/viewt ... 67#p146067 .

You should see there my metal box and EMI filters - it didn't help. Don't waste your time and money as I do.

Today I should receive MK808 and I hope that I will be able to work with two FullHD webcams - we will see.

Arthur
Let us know how you get on. Handling two HD cams takes some effort.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
with ice cream
Posts: 164
Joined: Mon Jul 30, 2012 7:25 am

Re: USB redux

Mon Jan 07, 2013 8:43 am

Just to chime in, my problems with a crashing LCD usb photo frame remain even with the latest (Jan 1) firmware/kernel.

User avatar
scrishton
Posts: 49
Joined: Mon May 07, 2012 8:48 pm
Location: Settle, in the Yorkshire Dales
Contact: Website

Re: USB redux

Mon Jan 07, 2013 12:30 pm

Licaon_Kter wrote:
scrishton wrote:However, with updated versions of Raspbian I can only use one 4-port card at a time.
Tried kernel 3.6.y yet via https://github.com/Hexxeh/rpi-update ?
Yes, I have tried '3.6.11+ #348 PREEMPT Tue Jan 1 16:33:22 GMT 2013 armv61' and it stops the keyboard working if more than one FTDI card is opened. With dwc_otg.speed=1 it will not work with my wired USB keyboard and will not enumerate the FTDI cards. Arch Linux behaves much the same. With the July version it will happily connect three FTDI cards giving twelve working RS422 ports - I haven't tried a 4th card yet, but have left a space in the box for further expansion. It works reliably for days on end sending at least 50 commands per second to each port and getting responses. I am currently getting rid of my LEGO and building the whole system into a compact 1U 19" rack mount box complete with internal power supply, front panel with 16 Cat5 connections, rear panel with HDMI, PAL video and four USB connections. And I have used it as a VT controller to record several programmes including A Question of Sport's 1000th episode, and the final of 'Britain's Brightest' with twelve Sony XDCam recorders. Not bad for a £22 computer.

Simon R.

spurfan15
Posts: 2
Joined: Wed Jan 09, 2013 12:57 am

Re: USB redux

Wed Jan 09, 2013 1:03 am

Hi guys, I just bought a few RPis and started playing around with some webcam + wifi stuff. So far, things have been going pretty well, but I'll be on the lookout for these USB issues. I work for a company that makes hardware USB analyzers, so I have some tools and top USB experts at my disposal. I will bring one of our USB 2.0 analyzers home to monitor the bus and I'll look for anything out of the ordinary. Are there any specific scenarios I should try reproducing? I can save and disseminate captured bus traffic if I'm able to reproduce a bug.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23709
Joined: Sat Jul 30, 2011 7:41 pm

Re: USB redux

Wed Jan 09, 2013 1:21 am

spurfan15 wrote:Hi guys, I just bought a few RPis and started playing around with some webcam + wifi stuff. So far, things have been going pretty well, but I'll be on the lookout for these USB issues. I work for a company that makes hardware USB analyzers, so I have some tools and top USB experts at my disposal. I will bring one of our USB 2.0 analyzers home to monitor the bus and I'll look for anything out of the ordinary. Are there any specific scenarios I should try reproducing? I can save and disseminate captured bus traffic if I'm able to reproduce a bug.
Thanks for the offer. I'm sure gsh would welcome some help. I believe he does have some sort of analyser, not sure what one.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

ivospi
Posts: 5
Joined: Mon Sep 24, 2012 5:14 am

Re: USB redux

Wed Jan 09, 2013 2:59 am

I don't know whether this is relevant to the USB issue, but when I perform a 'udevadm info' on any device related to the USB including eth0, it locks up my pi. It seems fine with other devices like block devices.
The lockup occurs even if I have no external USB device attached.

I have: 3.6.11+ #350 PREEMPT Mon Jan 7 21:51:11 GMT 2013

an example use of udevadm info that will lock my pi is:
udevadm info -a --path=/sys/class/net/eth0

When I do have external devices eg a 7 port hub with a usb serial adaptor and Digitech wifi adaptor, performing: udevadm info -a --path=/sys/class/tty/ttyUSB0 will also cause a lockup.

In all cases the lockup occurs when udevadm has walked up the chain of parent devices until it reaches :
'/devices/platform/bcm2708_usb', for which it reveals the following the freezes:

looking at parent device '/devices/platform/bcm2708_usb':
KERNELS=="bcm2708_usb"
SUBSYSTEMS=="platform"
DRIVERS=="dwc_otg"
ATTRS{hnp}=="HstNegScs = 0x0"
ATTRS{srp}=="SesReqScs = 0x1"
ATTRS{regvalue}=="invalid offset"
ATTRS{hsic_connect}=="HSIC Connect = 0x1"
ATTRS{guid}=="GUID = 0x2708a000"
ATTRS{mode}=="Mode = 0x1"
ATTRS{srpcapable}=="SRPCapable = 0x1"
ATTRS{regdump}=="Register Dump"
ATTRS{gpvndctl}=="GPVNDCTL = 0x00000000"
ATTRS{ggpio}=="GGPIO = 0x00000000"
ATTRS{hprt0}=="HPRT0 = 0x00001005"
ATTRS{wr_reg_test}=="Time to write GNPTXFSIZ reg 10000000 times: 340 msecs (34 jiffies)"
ATTRS{hcd_frrem}=="HCD Dump Frame Remaining"
ATTRS{mode_ch_tim_en}=="Mode Change Ready Timer Enable = 0x0"
ATTRS{gnptxfsiz}=="GNPTXFSIZ = 0x01000306"
ATTRS{remote_wakeup}=="Remote Wakeup Sig = 0 Enabled = 0 LPM Remote Wakeup = 0"

I suspect it is not related to the issue at hand, but someone may know

Ivo

User avatar
Licaon_Kter
Posts: 240
Joined: Wed Sep 05, 2012 10:12 am
Location: Between the keyboard and the chair.

Re: USB redux

Wed Jan 09, 2013 10:46 pm

scrishton wrote:I am currently getting rid of my LEGO and building the whole system into a compact 1U 19" rack mount box complete with internal power supply, front panel with 16 Cat5 connections, rear panel with HDMI, PAL video and four USB connections. And I have used it as a VT controller to record several programmes including A Question of Sport's 1000th episode, and the final of 'Britain's Brightest' with twelve Sony XDCam recorders. Not bad for a £22 computer.
duuude, it's the Intenets here, pics or it did not happen' :D
BFQ+BFS or RT on a RPi? 4'real: https://github.com/licaon-kter/ (source and compiled!)

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5331
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: USB redux

Wed Jan 09, 2013 11:14 pm

spurfan15 wrote:Hi guys, I just bought a few RPis and started playing around with some webcam + wifi stuff. So far, things have been going pretty well, but I'll be on the lookout for these USB issues. I work for a company that makes hardware USB analyzers, so I have some tools and top USB experts at my disposal. I will bring one of our USB 2.0 analyzers home to monitor the bus and I'll look for anything out of the ordinary. Are there any specific scenarios I should try reproducing? I can save and disseminate captured bus traffic if I'm able to reproduce a bug.
You could look through:
https://github.com/raspberrypi/linux/issues
https://github.com/raspberrypi/firmware/issues

and see if you can reproduce any USB issues.

There's various issues with lost pakcets. Some (but not all) wifi devices report ~50% lost packets, but it's not conclusive where (or even if) they are lost.
http://www.raspberrypi.org/phpBB3/viewt ... 28&t=27881

M33P
Posts: 199
Joined: Sun Sep 02, 2012 1:14 pm

Re: USB redux

Wed Jan 09, 2013 11:31 pm

Pi USB users:

https://github.com/raspberrypi/linux/co ... 58719fe9b3

I found a subtle but quite nasty bug in the dwc_otg driver, and posted a patch to github. New kernel is available via rpi_update.

Could you please test this if your use case involves
  • * More than one USB device active at one time
    * High-bandwidth devices like USB hard drives or other mass storage devices
    * Intensive network activity like streaming video or file server duties (including wifi devices)
Previously such intensive activities had a chance to corrupt kernel memory which would eventually lead to out-of-memory errors and possibly crash the Pi itself. It may also have affected extremely long-uptime low-bandwidth USB use (serial port adapters) if they were being used concurrently with another device. The effect would have been cumulative with each time the bug was hit, adding to the chance of unwanted behaviour.

Unfortunately this won't fix many of the webcam issues (or at least is unlikely to).

User avatar
scrishton
Posts: 49
Joined: Mon May 07, 2012 8:48 pm
Location: Settle, in the Yorkshire Dales
Contact: Website

Re: USB redux

Wed Jan 09, 2013 11:49 pm

Licaon_Kter wrote:
scrishton wrote:I am currently getting rid of my LEGO and building the whole system into a compact 1U 19" rack mount box complete with internal power supply, front panel with 16 Cat5 connections, rear panel with HDMI, PAL video and four USB connections. And I have used it as a VT controller to record several programmes including A Question of Sport's 1000th episode, and the final of 'Britain's Brightest' with twelve Sony XDCam recorders. Not bad for a £22 computer.
duuude, it's the Intenets here, pics or it did not happen' :D
Image

This is the Lego version of the controller. The RasPi is in the smaller Lego box on top, the lower section holds a D-Link 7 port hub and three FTDI 4-port RS422 cards. The VT machines are connected via D-type to RJ45 adapters at both ends to convert the pinout from the normal RS422 convention to Sony's version. Sony even use non standard screws on their D connectors. One advantage of using RJ45 is that I can extend it over cables which are already fitted in most studios.

Image

The software is written in Python, and has taken me about seven months to get to this stage. It is designed to use any monitor I can borrow, so it will run on the PAL video output if necessary - that's why it is only using low resolution and no fancy graphics.

The controller is now in a half depth 1U rack mount box. I'll perhaps add some pictures once I've managed to tidy the cables up a bit, but it is a tight squeeze with all the connectors overlapping each other. Pity the Pi has connectors on all sides - makes it quite difficult to fit in tight spaces. I thought about powering the Pi up it's USB output to save having the micro USB at the far end, but then I wouldn't be able to swap the SD card without completely dismantling the box.

But as I said, not bad for a £22 computer.

User avatar
scrishton
Posts: 49
Joined: Mon May 07, 2012 8:48 pm
Location: Settle, in the Yorkshire Dales
Contact: Website

Re: USB redux

Thu Jan 10, 2013 12:26 am

Hi M33P.

I have run rpi-update, rebooted, and tried my 12 channel RS422 system again. It still fails to read the keyboard if more than one FTDI card is opened. The only way to get back is to unplug the USB hub to crash out of the program. I have just tonight made some changes to my program so that it polls around spare RS422 channels in a daemon thread. That continues to work even when the keyboard is locked out. I should have tried that before updating to see if the update helped. But it shows that all the USBs are working - except the keyboard.

Hope this helps. And thanks very much. Simon R.

ivospi
Posts: 5
Joined: Mon Sep 24, 2012 5:14 am

Re: USB redux

Thu Jan 10, 2013 4:00 am

M33P wrote:Pi USB users:

https://github.com/raspberrypi/linux/co ... 58719fe9b3

I found a subtle but quite nasty bug in the dwc_otg driver, and posted a patch to github. New kernel is available via rpi_update.

Could you please test this if your use case involves
  • * More than one USB device active at one time
    * High-bandwidth devices like USB hard drives or other mass storage devices
    * Intensive network activity like streaming video or file server duties (including wifi devices)
Previously such intensive activities had a chance to corrupt kernel memory which would eventually lead to out-of-memory errors and possibly crash the Pi itself. It may also have affected extremely long-uptime low-bandwidth USB use (serial port adapters) if they were being used concurrently with another device. The effect would have been cumulative with each time the bug was hit, adding to the chance of unwanted behaviour.

Unfortunately this won't fix many of the webcam issues (or at least is unlikely to).
Well done M33P & thanks! This has made a big difference to the performance of my PI. I'm trying to learn the linux API so that I can develop a work application.

My hardware configuration is:

* 256MB model B PI.
* Poly fuses are shorted out
* Digitech wifi adaptor attached to the lower PI usb port.
* 7 port hub attached to the upper PI usb port
* usb rs232 cable attached to the hub. Send and receive pins are connected for loopback.
* PI is powered from the hub; the hub is powered from a 2A switch mode supply.
* control of the PI is via ssh.

My software consists of a simple client and server running on the PI. The client is sending 20 bytes every 25ms to the server via tcp/ip. This can be routed via either the wifi or the Ethernet. The server receives the clients data; sends it via the rs232; receives it from the rs232 and sends it back to the client. The server uses epoll_wait(). Seems a waste of time, but it is a learning exercise. The rs232 is configured for 38.4k baud.

When routing via wifi, I could only get operation for 10minutes to 1 hour before the PI would freeze. It was much better via Ethernet, which I found strange, where I have had it running 9 hours without a freeze.

So far with the new update, I have been running 3.5 hours via the wifi without a freeze. The PI is further loaded with top running flat out. I will leave it running over night to see whether it has totally fixed my problem, but it certainly seems good progress - well done!

Ivo

kermitas
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am

Re: USB redux

Thu Jan 10, 2013 8:08 am

jamesh wrote:
kermitas wrote: (...)
Today I should receive MK808 and I hope that I will be able to work with two FullHD webcams - we will see.
Let us know how you get on. Handling two HD cams takes some effort.
Dear jamesh,

I have played with MK808 for two days (it costs me exactly $46.99 inclugind shipping, http://www.aliexpress.com/snapshot/210148723.html , 18 days from buying to my hands).

It is fast, internal WiFi (in Android) works good, external usb WiFi works good in linux, Oracle JDK8 EA works good.

I was using old software caled "pre-alpha 0.3" (http://www.slatedroid.com/topic/41654-p ... imito-mx1/) and I was able to get video from my webcams but I also received thousands of "libv4l2: error dequeuing buf: Invalid argument" or "VIDIOC_DQBUF - Unable to dequeue buffer : Invalid argument" errors.

I will wait until Jan 15 when PicUntu (http://code.google.com/p/rk3066-linux/ Ubuntu for RockChip RK3066 like MK808, UG802) will be released, do next tests with one or two webcams and let you know.
Thanks.

dinjo
Posts: 20
Joined: Fri Jan 04, 2013 4:42 pm

Re: USB redux

Thu Jan 10, 2013 8:57 am

Cannot get automount working

Thread here - http://www.raspberrypi.org/phpBB3/viewt ... 28&t=28861

Code: Select all

[    2.544713] systemd[1]: Starting Forward Password Requests to Wall Directory Watch.
[    2.545447] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    2.545665] systemd[1]: Starting Remote File Systems.
[    2.546546] systemd[1]: Reached target Remote File Systems.
[    2.546741] systemd[1]: Expecting device sys-subsystem-net-devices-eth0.device...
[    2.547556] systemd[1]: Starting Syslog Socket.
[    2.548711] systemd[1]: Listening on Syslog Socket.
[    2.548918] systemd[1]: Starting Delayed Shutdown Socket.
[    2.549997] systemd[1]: Listening on Delayed Shutdown Socket.
[    2.550184] systemd[1]: Starting /dev/initctl Compatibility Named Pipe.
[    2.551219] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.
[    2.551405] systemd[1]: Starting Encrypted Volumes.
[    2.552296] systemd[1]: Reached target Encrypted Volumes.
[    2.552564] systemd[1]: Starting Dispatch Password Requests to Console Directory Watch.
[    2.553089] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    2.553863] systemd[1]: Starting udev Kernel Socket.
[    2.554941] systemd[1]: Listening on udev Kernel Socket.
[    2.555701] systemd[1]: Starting udev Control Socket.
[    2.556821] systemd[1]: Listening on udev Control Socket.
[    2.557271] systemd[1]: Starting Arbitrary Executable File Formats File System Automount Point.
[    2.559011] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.559213] systemd[1]: Starting Swap.
[    2.559976] systemd[1]: Reached target Swap.
[    2.560164] systemd[1]: Expecting device dev-mmcblk0p1.device...
[    2.560949] systemd[1]: Starting Journal Socket.
[    2.562349] systemd[1]: Listening on Journal Socket.
[    2.562597] systemd[1]: Mounting Temporary Directory...
[    2.565164] systemd[1]: tmp.mount: Directory /tmp to mount over is not empty, mounting anyway. (To see the over-mounted files, please manually mount the underlying file system to a secondary location.)
[    2.568628] systemd[1]: Started File System Check on Root Device.
[    2.568965] systemd[1]: Starting Remount Root and Kernel File Systems...
[    2.613702] systemd[1]: Started Load Kernel Modules.
[    2.613961] systemd[1]: Mounted FUSE Control File System.
[    2.628056] systemd[1]: Starting Apply Kernel Variables...
[    2.645547] systemd[1]: Started Set Up Additional Binary Formats.
[    2.645829] systemd[1]: Mounted Huge Pages File System.
[    2.645999] systemd[1]: Starting Setup Virtual Console...
[    2.653329] systemd[1]: Starting udev Coldplug all Devices...
[    2.668542] systemd[1]: Starting udev Kernel Device Manager...
[    2.683489] systemd[1]: Mounting POSIX Message Queue File System...
[    2.693928] systemd[1]: Mounting Debug File System...
[    2.708224] systemd[1]: Mounting Configuration File System...
[    2.725190] systemd[1]: Starting Journal Service...
[    2.744730] systemd[1]: Started Journal Service.
[    2.745237] systemd[1]: Starting Syslog.
[    2.747808] systemd[1]: Reached target Syslog.
[    3.022627] usb 1-1.2: new high-speed USB device number 4 using dwc_otg
[    3.079757] systemd-udevd[51]: starting version 196
[    3.124179] usb 1-1.2: New USB device found, idVendor=0bc2, idProduct=5021
[    3.124212] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.124229] usb 1-1.2: Product: FreeAgent GoFlex
[    3.124244] usb 1-1.2: Manufacturer: Seagate
[    3.124258] usb 1-1.2: SerialNumber: NA0EV57Q
[    3.131382] scsi0 : usb-storage 1-1.2:1.0
[    4.108408] bcm2708_spi bcm2708_spi.0: master is unqueued, this is deprecated
[    4.108662] bcm2708_spi bcm2708_spi.0: SPI Controller at 0x20204000 (irq 80)
[    4.111324] bcm2708_i2c bcm2708_i2c.0: BSC0 Controller at 0x20205000 (irq 79) (baudrate 100k)
[    4.116464] bcm2708_i2c bcm2708_i2c.1: BSC1 Controller at 0x20804000 (irq 79) (baudrate 100k)
[    4.123797] scsi 0:0:0:0: Direct-Access     Seagate  FreeAgent GoFlex 0148 PQ: 0 ANSI: 4
[    4.125801] sd 0:0:0:0: [sda] 976773167 512-byte logical blocks: (500 GB/465 GiB)
[    4.126619] sd 0:0:0:0: [sda] Write Protect is off
[    4.126652] sd 0:0:0:0: [sda] Mode Sense: 1c 00 00 00
[b][    4.127418] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA[/b]
[    4.198434]  sda: sda2
[    4.203936] sd 0:0:0:0: [sda] Attached SCSI disk
[    4.209349] Registered led device: led0
[    5.070805] systemd-journald[55]: Received SIGUSR1
[    5.172086] systemd-journald[55]: File /var/log/journal/5c49cb5bf08724338eb09a6900092bb0/system.journal corrupted or uncleanly shut down, renaming and replacing.
[    6.291074] NET: Registered protocol family 10
[    6.303147] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    7.045738] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.048067] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0x45E
1

User avatar
scrishton
Posts: 49
Joined: Mon May 07, 2012 8:48 pm
Location: Settle, in the Yorkshire Dales
Contact: Website

Re: USB redux

Thu Jan 10, 2013 11:02 am

M33P,

with your bug fix from yesterday my controller was able to run all night without the usual crash I get from 3.6.11. Still unable to read keyboard with more than one FTDI card. I just tried a different USB keyboard - this still fails in the same way, but interesting to note that the numlock light lit after a few seconds. There is a system call at the start of the program to set the numlock key, so it is probably a delayed result of that.

If I replace the FTDI cards with three Prolific PL2303 single port RS422s, everything works fine. This is a big improvement, and the first time I have managed to get more than one PL2303 to work. Add back an FTDI and the keyboard starts to miss occasional keys or repeat keys, sometimes getting stuck endlessly repeating. Crash out of the program and quick brown foxes can jump all day over lazy dogs without problems on the console. Run the program and open a second console, the keyboard repeats on the second console. Add a second FTDI and the keyboard stops working completely on the program, but still works on the console when the program is not running.

Simon R.

M33P
Posts: 199
Joined: Sun Sep 02, 2012 1:14 pm

Re: USB redux

Thu Jan 10, 2013 7:00 pm

scrishton wrote:M33P,

with your bug fix from yesterday my controller was able to run all night without the usual crash I get from 3.6.11. Still unable to read keyboard with more than one FTDI card. I just tried a different USB keyboard - this still fails in the same way, but interesting to note that the numlock light lit after a few seconds. There is a system call at the start of the program to set the numlock key, so it is probably a delayed result of that.

If I replace the FTDI cards with three Prolific PL2303 single port RS422s, everything works fine. This is a big improvement, and the first time I have managed to get more than one PL2303 to work. Add back an FTDI and the keyboard starts to miss occasional keys or repeat keys, sometimes getting stuck endlessly repeating. Crash out of the program and quick brown foxes can jump all day over lazy dogs without problems on the console. Run the program and open a second console, the keyboard repeats on the second console. Add a second FTDI and the keyboard stops working completely on the program, but still works on the console when the program is not running.

Simon R.
Glad to see my patch now results in a workable system for you. (And ivospi)

The way both the FTDI and PL2303 drivers work is to submit an interrupt URB, one per virtual serial port, on opening of the port. This allows for characters in the adapter's Rx buffer to be notified to the host "quickly".

USB HID devices also use interrupt transfers to report key events.

In a sensible USB host driver, interrupt URBs are usually assigned first dibs on the (micro)frame time as they are rarely more than 64 bytes long and require no retransmission - they are simply to notify the host that the device needs attention. They should also be assigned first because this reduces latency in servicing the "interrupt". These transactions repeat every n milliseconds, which is usually specified by the device as its polling interval.

The problem occurs when we ask the dwc_otg driver to handle "lots" of periodic transactions - for reasons yet to be fathomed it barfs quite horribly with lots of interrupt transactions or just one large-size isochronous transaction.

Note that wifi devices will probably still suffer from throughput issues as I can replicate this reliably with the latest kernel, but should not crash the pi at least.

ivospi
Posts: 5
Joined: Mon Sep 24, 2012 5:14 am

Re: USB redux

Thu Jan 10, 2013 7:55 pm

ivospi wrote:
M33P wrote:Pi USB users:

https://github.com/raspberrypi/linux/co ... 58719fe9b3

I found a subtle but quite nasty bug in the dwc_otg driver, and posted a patch to github. New kernel is available via rpi_update.

Could you please test this if your use case involves
  • * More than one USB device active at one time
    * High-bandwidth devices like USB hard drives or other mass storage devices
    * Intensive network activity like streaming video or file server duties (including wifi devices)
Previously such intensive activities had a chance to corrupt kernel memory which would eventually lead to out-of-memory errors and possibly crash the Pi itself. It may also have affected extremely long-uptime low-bandwidth USB use (serial port adapters) if they were being used concurrently with another device. The effect would have been cumulative with each time the bug was hit, adding to the chance of unwanted behaviour.

Unfortunately this won't fix many of the webcam issues (or at least is unlikely to).
Well done M33P & thanks! This has made a big difference to the performance of my PI. I'm trying to learn the linux API so that I can develop a work application.

My hardware configuration is:

* 256MB model B PI.
* Poly fuses are shorted out
* Digitech wifi adaptor attached to the lower PI usb port.
* 7 port hub attached to the upper PI usb port
* usb rs232 cable attached to the hub. Send and receive pins are connected for loopback.
* PI is powered from the hub; the hub is powered from a 2A switch mode supply.
* control of the PI is via ssh.

My software consists of a simple client and server running on the PI. The client is sending 20 bytes every 25ms to the server via tcp/ip. This can be routed via either the wifi or the Ethernet. The server receives the clients data; sends it via the rs232; receives it from the rs232 and sends it back to the client. The server uses epoll_wait(). Seems a waste of time, but it is a learning exercise. The rs232 is configured for 38.4k baud.

When routing via wifi, I could only get operation for 10minutes to 1 hour before the PI would freeze. It was much better via Ethernet, which I found strange, where I have had it running 9 hours without a freeze.

So far with the new update, I have been running 3.5 hours via the wifi without a freeze. The PI is further loaded with top running flat out. I will leave it running over night to see whether it has totally fixed my problem, but it certainly seems good progress - well done!

Ivo
Just to report back after running it for one night - still running no problems after 19.5 hours. This is heaps better!

Return to “Troubleshooting”