thexman
Posts: 259
Joined: Sat Apr 07, 2012 2:18 pm

Re: USB packet loss.

Wed Aug 08, 2012 8:10 pm

Bump

still no Fixes lots of people still complaining about this and that wont or don't work, and still no one has posted a definitive solution to the problem can't see the Pi product going into schools with such a big issue, which I've previously been told is not a Priority Fix

I think it is a Priority if you wish to make the 2012/2013 education year if not the 2013/2014 wont be obtainable either as technology moves on wait too long and something else will just take its place.
one armed controls engineer, my grammar is bad but lets face it most keyboards don't suit a one armed man

jsalk
Posts: 11
Joined: Thu Jul 12, 2012 12:11 pm

Re: USB packet loss.

Wed Aug 08, 2012 8:44 pm

Agreed. This is a deal-breaker.

- Jim

lostintime
Posts: 29
Joined: Sun Jul 22, 2012 7:30 am

Re: USB packet loss.

Wed Aug 08, 2012 10:56 pm

thexman wrote:still no Fixes lots of people still complaining about this and that wont or don't work, and still no one has posted a definitive solution to the problem can't see the Pi product going into schools with such a big issue, which I've previously been told is not a Priority Fix
If the Raspberry Pi Foundation thinks the issues the Raspberry Pi has with its USB subsystem aren't an extremely serious problem then they are insane.
I think it is a Priority if you wish to make the 2012/2013 education year if not the 2013/2014 wont be obtainable either as technology moves on wait too long and something else will just take its place.
I don't think the Pi will ever make very much of an impact in the education sector. The efforts they've made to link the Raspberry Pi to the BBC Micro just look a combination of hubris and arrogance now. The BBC certainly wasn't perfect but it never had the kind of problems the Pi has.

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: USB packet loss.

Wed Aug 08, 2012 11:13 pm

Updates on USB system issues. A cause of the missing packets has been identified.
http://www.raspberrypi.org/phpBB3/viewt ... 75#p141987
http://www.raspberrypi.org/phpBB3/viewt ... 78#p145479

lostintime
Posts: 29
Joined: Sun Jul 22, 2012 7:30 am

Re: USB packet loss.

Thu Aug 09, 2012 12:08 am

jbeale wrote:Updates on USB system issues. A cause of the missing packets has been identified.
http://www.raspberrypi.org/phpBB3/viewt ... 75#p141987
http://www.raspberrypi.org/phpBB3/viewt ... 78#p145479
From your second link, gsh posted: "So currently I'm not convinced that there is a bug in the USB driver at all, the main problem is that the linux interrupt latency is in general terrible!".

Do I understand correctly that gsh (Gordon) is the only Broadcom employee working on the Pi's USB issues?

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Fri Aug 10, 2012 9:22 am

I have a program that communicates over USB and code that works fine on ubuntu/suse but is not working on RPi. I have added debug to the code and monitored the USB transactions using an Ellisys USB Explorer and either there is a bug in the Libusb-1.0 ARM implementation or RPi handling.

The problems occur using

Code: Select all

int libusb_interrupt_transfer 	( 	struct libusb_device_handle *  	dev_handle,
		unsigned char  	endpoint,
		unsigned char *  	data,
		int  	length,
		int *  	transferred,
		unsigned int  	timeout 
	) 	
where I see a timeout on a write unless I set a timeout of 50ms or more - note that the data is transmitted but the call times out saying 0 bytes written. I can see data being read but it is never seen by my program. It looks to me as if the USB transactions are happening at the interface but data being returned to the call is being lost/corrupted in the service routine.

To put this into perspective there is an initialisation of 15 read/writes of 64bytes done without any time constraint and so far it has never completed successfully.

Moving to RPiTC build appears to be even worse. This makes me believe there is a bug in the USB handling.

Any thoughts?

David

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: USB packet loss.

Fri Aug 10, 2012 9:33 am

DAFlippers wrote:I have a program that communicates over USB and code that works fine on ubuntu/suse but is not working on RPi. I have added debug to the code and monitored the USB transactions using an Ellisys USB Explorer and either there is a bug in the Libusb-1.0 ARM implementation or RPi handling.

The problems occur using

Code: Select all

int libusb_interrupt_transfer 	( 	struct libusb_device_handle *  	dev_handle,
		unsigned char  	endpoint,
		unsigned char *  	data,
		int  	length,
		int *  	transferred,
		unsigned int  	timeout 
	) 	
where I see a timeout on a write unless I set a timeout of 50ms or more - note that the data is transmitted but the call times out saying 0 bytes written. I can see data being read but it is never seen by my program. It looks to me as if the USB transactions are happening at the interface but data being returned to the call is being lost/corrupted in the service routine.

To put this into perspective there is an initialisation of 15 read/writes of 64bytes done without any time constraint and so far it has never completed successfully.

Moving to RPiTC build appears to be even worse. This makes me believe there is a bug in the USB handling.

Any thoughts?

David
can you post on that thread and get some extra info going
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

ejsolutions
Posts: 96
Joined: Fri Jun 29, 2012 2:27 pm
Location: In the sticks of Haggisland

Re: USB packet loss.

Fri Aug 10, 2012 10:02 am

I'm posting here, rather than on other threads (it's very fragmented!) in the hope that it helps someone.
I'm finally making some progress with the fiasco that is Pi USB. No point in going over the same old ground but suffice to say that 5 hubs, numerous 5v power supplies and cables later, I appear to have a semi-working basic system.

Code: Select all

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 1017:0002 Speedy Industrial Supplies, Pte., Ltd 
Bus 001 Device 005: ID 04cc:1521 ST-Ericsson USB 2.0 Hub
Bus 001 Device 006: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 007: ID 0aec:3260 Neodio Technologies Corp. 7-in-1 Card Reader
I can now copy files to a 8Gb Microdrive connected to the Card Reader, without wireless getting its' knickers in a twist. The key element to this success has been relatively simple, once found and is this little snippet.
https://github.com/raspberrypi/firmware/issues/19 by popcornmix
Can you try latest firmware (e.g. from rpi-update or bleeding-edge firmware repo) and add:
sdhci-bcm2708.missing_status=0 sdhci-bcm2708.sync_after_dma=0
to cmdline.txt. We think there may be USB packet loss caused by sdcard driver disabling interrupts for too long.
[I'm currently running preempt #168]
Now to try out all manner of things, examples being the original Ralink wireless, HDD, other hubs.

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Fri Aug 10, 2012 1:23 pm

RaTTuS wrote: can you post on that thread and get some extra info going
Which thread?

David

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: USB packet loss.

Fri Aug 10, 2012 3:25 pm

I'm running a custom kernel (to support PPS timing signal from GPS) but would like to try the new firmware. Not sure if rpi-update will try to "fix" my kernel also, so is there a manual install method for new firmware? And if so is there a step-by-step instruction for that? Where exactly is the firmware file I need? Thanks for any pointers!

User avatar
RaTTuS
Posts: 10459
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: USB packet loss.

Fri Aug 10, 2012 3:27 pm

DAFlippers wrote:
RaTTuS wrote: can you post on that thread and get some extra info going
Which thread?

David
http://www.raspberrypi.org/phpBB3/viewt ... 00#p145479
there I think - sorry missed this before
busy busy day
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

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

Re: USB packet loss.

Fri Aug 10, 2012 3:37 pm

lostintime wrote:
jbeale wrote:Updates on USB system issues. A cause of the missing packets has been identified.
http://www.raspberrypi.org/phpBB3/viewt ... 75#p141987
http://www.raspberrypi.org/phpBB3/viewt ... 78#p145479
From your second link, gsh posted: "So currently I'm not convinced that there is a bug in the USB driver at all, the main problem is that the linux interrupt latency is in general terrible!".

Do I understand correctly that gsh (Gordon) is the only Broadcom employee working on the Pi's USB issues?
I believe so, part time. Remember, Broadcom are a busy company, and the Raspberry Pi makes little or no money for them....

But, there is progress, and the issue is being taken seriously, contrary to what some people seem to believe.
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."

thexman
Posts: 259
Joined: Sat Apr 07, 2012 2:18 pm

Re: USB packet loss.

Fri Aug 10, 2012 7:12 pm

Thanks James for the response and all the people working on a solution I'm presently pleased that progress is comming the 8pi's I have can hopefully soon be unboxd installed with software and tested for release hears hoping
one armed controls engineer, my grammar is bad but lets face it most keyboards don't suit a one armed man

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Fri Aug 10, 2012 8:10 pm

jamesh wrote:But, there is progress, and the issue is being taken seriously, contrary to what some people seem to believe.
I take from that there is an acknowledged issue and it is being investigated so I'll hold off on this work as I know my code runs on other hardware without a problem and await an update.

BTW is there a bug list and status for RPi issues?

David

asb
Forum Moderator
Forum Moderator
Posts: 853
Joined: Fri Sep 16, 2011 7:16 pm
Contact: Website

Re: USB packet loss.

Fri Aug 10, 2012 8:16 pm

DAFlippers wrote:
jamesh wrote:But, there is progress, and the issue is being taken seriously, contrary to what some people seem to believe.
I take from that there is an acknowledged issue and it is being investigated so I'll hold off on this work as I know my code runs on other hardware without a problem and await an update.

BTW is there a bug list and status for RPi issues?

David
Check out https://github.com/raspberrypi/firmware/issues and https://github.com/raspberrypi/linux/issues

It's particularly awesome if you can provide detailed bug reports (test cases are useful), and have the ability to compile and test patches.

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Fri Aug 10, 2012 8:24 pm

asb wrote:
It's particularly awesome if you can provide detailed bug reports (test cases are useful), and have the ability to compile and test patches.
I'll post a detailed bug report but is it a firmware or Linux implementation issue - now that's the question.

David

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 packet loss.

Fri Aug 10, 2012 8:59 pm

DAFlippers wrote: I'll post a detailed bug report but is it a firmware or Linux implementation issue - now that's the question.
Doesn't really matter where you file it.
USB is all handled by Linux kernel, so Linux is more appropriate.

lostintime
Posts: 29
Joined: Sun Jul 22, 2012 7:30 am

Re: USB packet loss.

Fri Aug 10, 2012 11:34 pm

jamesh wrote:
lostintime wrote:
jbeale wrote:Updates on USB system issues. A cause of the missing packets has been identified.
http://www.raspberrypi.org/phpBB3/viewt ... 75#p141987
http://www.raspberrypi.org/phpBB3/viewt ... 78#p145479
From your second link, gsh posted: "So currently I'm not convinced that there is a bug in the USB driver at all, the main problem is that the linux interrupt latency is in general terrible!".

Do I understand correctly that gsh (Gordon) is the only Broadcom employee working on the Pi's USB issues?
I believe so, part time. Remember, Broadcom are a busy company, and the Raspberry Pi makes little or no money for them....

But, there is progress, and the issue is being taken seriously, contrary to what some people seem to believe.
Not seriously enough. The USB issues won't just be specific to the Raspberry Pi but will affect anything else that uses the BCM2835 SoC.

User avatar
jackokring
Posts: 816
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
Contact: ICQ

Re: USB packet loss.

Fri Aug 10, 2012 11:55 pm

Maybe a USB addendum for CRC on data, and a packet order. Packet loss is an endemic radio crackle problem. Anything which can not deal with this natural crackle possibility is not living in the analog world, but assuming digital perfection. After all burst packet data would not get as far on a USB wire without some error correction code. Packet loss is a related but different matter, and the protocol should have a built in way of dealing with it. Ethernet does.

Cheers Jacko
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028

secretagent
Posts: 36
Joined: Wed Mar 07, 2012 10:09 am

Re: USB packet loss.

Sat Aug 11, 2012 12:25 am

jackokring wrote:Maybe a USB addendum for CRC on data, and a packet order. Packet loss is an endemic radio crackle problem. Anything which can not deal with this natural crackle possibility is not living in the analog world, but assuming digital perfection. After all burst packet data would not get as far on a USB wire without some error correction code. Packet loss is a related but different matter, and the protocol should have a built in way of dealing with it.
The thing is, USB does have error detection and acks/retransmission for most types of packets at the lower layers. However, at least some of the problems here occur between the USB hardware and the driver. So, the hardware has received and acknowledged the packets but the driver cannot always process them properly and on time. In other words, the "analog world" is taken care of and the problems happen within the digital land.

jvinolas
Posts: 1
Joined: Sat Aug 11, 2012 12:02 am

Re: USB packet loss.

Sat Aug 11, 2012 12:30 am

I solved my problem with usb!

I was getting mad with a 3g modem and raspberry pi (Huawei e169). In the end I realized that the problem was de power supply. So it was easy: replace with a new powerful one.

Then the problem was that the voltage on power outlet was an stable 5 volt while in TP1/TP2 was 4.8/4.7: the problem was the micro usb. So I plugged my 5 volt supply directly to 5V/GND in P1. Problem solved? Not yet!

After that, voltage in TP1/TP2 was stable at 5V, but modem still hang up at the end of configuration, just when it connected to network. I measured the voltage directly on the double USB case and, just when modem connected to network and power consumption was at max, the voltage there went down to 3.6V!!!

So, the solution: I soldered a cable directly from P1 5V (where I connect my power supply) to 5 volt on USB plug on raspberry pi. PROBLEM SOLVED! Now the 3g usb modem never hangs!!

This is the picture of what I did. Note that I only soldered the cable to one 5V pin on USB, the one that is connected to one of the usb plugs. I think there is another 5V pin for the other usb plug (raspi version B).
Image
Hope it helps!

User avatar
jackokring
Posts: 816
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
Contact: ICQ

Re: USB packet loss.

Sat Aug 11, 2012 12:37 am

Don't acknowledge the packet until the packet is on the device pipe? To drive the chip acknowledged on interrupt without a full buffer copy may cause such things. Also bad hardware flow control would cause this too. Copy before acknowledge on the interrupt front!

Cheers Jacko
Pi[NFA]=B256R0USB CL4SD8GB Raspbian Stock.
Pi[Work]=A+256 CL4SD8GB Raspbian Stock.
My favourite constant 1.65056745028

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Sat Aug 11, 2012 8:11 am

dom wrote:
DAFlippers wrote: I'll post a detailed bug report but is it a firmware or Linux implementation issue - now that's the question.
Doesn't really matter where you file it.
USB is all handled by Linux kernel, so Linux is more appropriate.
Being pedantic if the problem turns out to be in the Broadcom area then it is likely to be a firmware issue hence my question however I have posted it in Linux area so it can be investigated.

https://github.com/raspberrypi/linux/issues/79

David

DAFlippers
Posts: 26
Joined: Fri Aug 10, 2012 8:39 am
Location: Berkshire

Re: USB packet loss.

Sat Aug 11, 2012 8:18 am

jackokring wrote:Don't acknowledge the packet until the packet is on the device pipe? To drive the chip acknowledged on interrupt without a full buffer copy may cause such things. Also bad hardware flow control would cause this too. Copy before acknowledge on the interrupt front!

Cheers Jacko
I'm sure you are aware but others may be interested to know that the USB specifications are available to download from http://www.usb.org/developers/docs/

David

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

Re: USB packet loss.

Sat Aug 11, 2012 8:53 am

lostintime wrote:
jamesh wrote:
lostintime wrote:
From your second link, gsh posted: "So currently I'm not convinced that there is a bug in the USB driver at all, the main problem is that the linux interrupt latency is in general terrible!".

Do I understand correctly that gsh (Gordon) is the only Broadcom employee working on the Pi's USB issues?
I believe so, part time. Remember, Broadcom are a busy company, and the Raspberry Pi makes little or no money for them....

But, there is progress, and the issue is being taken seriously, contrary to what some people seem to believe.
Not seriously enough. The USB issues won't just be specific to the Raspberry Pi but will affect anything else that uses the BCM2835 SoC.
All the current other uses of the 2835 seem to be fine - probably because they don't use the USB in the same way.It's an old chip - all new users are on different chips now (and again, don't usually use the USB in the same way)
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."

Return to “Troubleshooting”