Page 1 of 1

USB ports bandwidth

Posted: Tue Jan 31, 2017 5:19 am
by julyjim
Are USB ports connected to common controller or are they separate?
I am concerned about practical USB bandwidth.
How many USB web cams ( small frame format, no HD ) can I connect / run on the entire board?

Thanks

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 10:36 am
by DougieLawson
Common LAN9514 controller (which also runs the ethernet). On an A, A+ and Zero there is no USB controller, there's just a single USB port driven from the BCM2835 SoC.

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 10:39 am
by mikerr
Note the raspberry pi camera doesn't use USB bandwidth at all - and you can use two of them on the compute module...

You can use that in addition to USB webcams.

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 1:58 pm
by julyjim
Thanks for reply, but that was not what I asked , sorry.

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 2:08 pm
by RaTTuS
480mbps is the max for the USB port
what do your cameras output ?
what are you wanting to do with the output of the cameras
the RPI camera is much better than most usb cameras [YMMV]

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 4:16 pm
by jamesh
All the four USB ports on the Pi B models are muxed on to a single USB port in to the SoC, so you are restricted to an overall bandwidth of about USB2 rates, which is usually about half of theoretical maximum once you take in to account overheads. Not only that but the ethernet is muxed on to the same port as well, so you need to take that in to account as well.

As someone above says, the Pi camera does not use USB and does not impact on the USB port at all.

Re: USB ports bandwidth

Posted: Tue Jan 31, 2017 5:43 pm
by W. H. Heydt
jamesh wrote:All the four USB ports on the Pi B models are muxed on to a single USB port in to the SoC, so you are restricted to an overall bandwidth of about USB2 rates, which is usually about half of theoretical maximum once you take in to account overheads. Not only that but the ethernet is muxed on to the same port as well, so you need to take that in to account as well.
Depending on how you figure it, you may do a bit better than half.. My SSD read test (reading 3.2GB) using a Pi3B came in at 35MB/s. Just counting 8 bits per byte, with no added start/stop, parity, or other overhead, that would 260Mb/s. If you use the old serial line rule of thumb of 10 bits per byte transferred, it would 350Mb/s, or nearly 3/4 of theoretical maximum.

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 2:00 pm
by julyjim
Thanks for very compressive answers , appreciate that very much.

Small , tiny side note.
I am always puzzled why people need to know the actual application . usage / reason the question is posted. I always assume they are curious, but deep down it reminds me of people who repeat the spoken question not to clarify it, but to stall for time so they can figure out the answer.

To satisfy the curiosity - I am planning to have several cameras monitoring and controlling model railroad.
Look up "green wave" concept for further clarification.

Cheers

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 2:34 pm
by W. H. Heydt
julyjim wrote:Thanks for very compressive answers , appreciate that very much.

Small , tiny side note.
I am always puzzled why people need to know the actual application . usage / reason the question is posted. I always assume they are curious, but deep down it reminds me of people who repeat the spoken question not to clarify it, but to stall for time so they can figure out the answer.

To satisfy the curiosity - I am planning to have several cameras monitoring and controlling model railroad.
Look up "green wave" concept for further clarification.

Cheers
Quite a bit of the "what project?" question revolves around potential alternate solutions to specific roadblocks. In your case, it appears to me that rather than worrying about how many cameras can be connected to a single Pi, you could deply as many Pis as it takes to support the number of cameras you are planning to use, possibly right down to one camera per Pi.

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 2:41 pm
by mikerr
If you want an answer to how many cameras you can use, you need to tell us the bandwidth each individual camera uses in your use case (which you haven't)

The pi has 480Mbps total. Divide that by the bitrate of your cameras (which will vary greatly depending on framesize, format and frame rate)

E.g. if you only wanted 1 frame per second,you could probably use 20+ cameras via a usb hub...

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 6:42 pm
by ejolson
mikerr wrote:E.g. if you only wanted 1 frame per second,you could probably use 20+ cameras via a usb hub...
According to the General Information bullet point 2 from the USB sticky thread in Troubleshooting, the hardware has a limit of 8 simultaneously active USB transactions. Since Ethernet counts for one, bandwidth considerations aside, that leaves at most 7 available for cameras.

Green wave seems to be a real-time railway traffic management policy for optimizing rail traffic through open corridors that bottleneck a network. It sounds fun but difficult to implement in a model railroad setting.

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 8:23 pm
by Heater
julyjim,
I am always puzzled why people need to know the actual application . usage / reason the question is posted. I always assume they are curious, but deep down it reminds me of people who repeat the spoken question not to clarify it, but to stall for time so they can figure out the answer.
No. A moments reflection would tell you that we have no need to repeat the question or stall for time before we answer. This is an internet forum. We can answer now or after an hour or next week or perhaps not at all.

Curiosity is certainly a motivation for asking about the actual application.

But the main point is this: So many times it happens that someone pops up with a question like "Please tell me how to do X" or "I tried X and it did not work". After much time wasting toing and froing and debate we find out they never really wanted to do X at all. They thought X was a solution to what they really wanted to do and there are other better ways of doing it.

Just trying to be efficient.

Re: USB ports bandwidth

Posted: Wed Feb 01, 2017 9:05 pm
by CarlRJ
julyjim wrote:Small , tiny side note.
I am always puzzled why people need to know the actual application . usage / reason the question is posted. I always assume they are curious, but deep down it reminds me of people who repeat the spoken question not to clarify it, but to stall for time so they can figure out the answer.
It can remind you of whatever you want, but your guess is incorrect. And stalling for time in a non-realtime conversation is laughable. Everyone knows that we've all got google/stackoverflow/etc available to us at a second's notice. We could copy and paste a voluminous-but-perhaps-not-applicable-answer from somewhere in thirty seconds. So that's not the reason for asking for more information...

You are asking for help from a pool of developers and tinkerers with collectively an absolutely enormous amount of experience answering such questions, and many of us have found, over the years, that people often ask questions that are two or three steps down the path from what they really have in mind. That is, they had an original question/need in mind, and they made two or three assumptions from that, and they're now asking a question that may be going down some odd, really convoluted, possibly unworkable, path towards their goal. So, we want to answer the question as asked (if possible), but often want to know what the original goal was, if the question asked seems odd (or if we've seen a similar question raised in the past on the basis of an odd assumption), because we (collectively) may be able to suggest a much simpler solution that sidesteps the original (and possibly incorrect) assumptions. We are problem solvers. Sometimes it helps to know what the whole problem is, rather than just one small corner of it.

Re: USB ports bandwidth

Posted: Thu Feb 02, 2017 7:39 am
by RaTTuS
julyjim wrote:Thanks for very compressive answers , appreciate that very much.

Small , tiny side note.
I am always puzzled why people need to know the actual application . usage / reason the question is posted. I always assume they are curious, but deep down it reminds me of people who repeat the spoken question not to clarify it, but to stall for time so they can figure out the answer.

To satisfy the curiosity - I am planning to have several cameras monitoring and controlling model railroad.
Look up "green wave" concept for further clarification.

Cheers
why usb cams ?
which usb cams
post links to them all
they often have bad resolutions or do not compress the data in any useful way YMWV on how many you can stuff onto a USB chain
give use more useful info and we can help more , faster and with better info
what are you thinking of , have you though of using the foundation camera ?
multiple RPI's ?
a PI0 + camaera + network hat may be a better option , or PI2 or Pi3

Re: USB ports bandwidth

Posted: Thu Feb 02, 2017 12:06 pm
by texy
RaTTuS wrote: a PI0 + camaera + network hat may be a better option , or PI2 or Pi3
+1 however we have no idea of budget or infrastructure. Yup we always have further questions :D
Texy

Re: USB ports bandwidth

Posted: Thu Feb 02, 2017 12:32 pm
by mikerr
ejolson wrote:According to the General Information bullet point 2 from the USB sticky thread in Troubleshooting, the hardware has a limit of 8 simultaneously active USB transactions. Since Ethernet counts for one, bandwidth considerations aside, that leaves at most 7 available for cameras.
Not sure on the continued accuracy of that - there's a note on this thread that says the "8 endpoints limit" is removed, and also someone successfully tested 13 devices:
viewtopic.php?f=63&t=13917

..and for grins I started a new thread with some tests:
viewtopic.php?f=63&t=173343