A bunch of unexplained questions, in detail, regarding usb and avr

Hmm...okaay. Hey everyone. This kind of topic has been here for ages, but not once have i found a clear point to point explanation. So,

  1. Lets start with a dumb one..

Can an arduino(uno/nano,mega,mini) or nodemcu 'see' all the bits of an usb D+ D- pin? I mean, can the mcu pins switch state fast enough to keep up with the usb transmission?

  1. How much actual data bandwidth is required to pass a 2MP video stream over usb?

  2. Why is it mostly a big no-no when it comes to using a nodemcu/wifi capable mcu to create a transparent wireless bridge?

  3. This one.... Please remember im still learning..

Everytime there is a discussion about using a certain usb device with an mcu, why does the driver thing come up? Is it essential that the mcu that is connected to the device has to call the protocols of that device? Why cant the device send the traffic over to a capable device, for example, a pc, and then the pc can decide how to process the data.

Simply put, just as a wire conveys the data from point A to point B, why is it improbable(impossible?) to do it over a wireless method? So basically a wireless wire.. Huh

  1. Yes of course - otherwise it could not communicate over the USB cable. On an Uno (for example) there is a second microprocessor that actually handles the USB communication.

  2. I have no idea, but it seems an irrelevant question as an Arduino is not nearly powerful enough to handle video. Video is complex technology that uses a lot of very complicated compression to reduce the required bandwidth.

  3. I suspect the reason is the same as for 2 - the Arduino would not be fast enough or have enough memory.

  4. I may not understand your question. When you connect a device to a PC using a USB cable the PC operating system needs to identify it and choose the correct driver software to facilitate the communication with the device. You could think of the driver as the equivalent of a human language interpreter at a multi-national meeting.

...R

kaseftamjid:
4. This one.... Please remember im still learning..

Everytime there is a discussion about using a certain usb device with an mcu, why does the driver thing come up? Is it essential that the mcu that is connected to the device has to call the protocols of that device? Why cant the device send the traffic over to a capable device, for example, a pc, and then the pc can decide how to process the data.

Simply put, just as a wire conveys the data from point A to point B, why is it improbable(impossible?) to do it over a wireless method? So basically a wireless wire.. Huh

USB devices require a driver in the operating system that it is connected to, which defines how the PC (or other device) interacts, its how the USB interface and operating systems were designed.

Could it have been designed differently, probably, but it is the way it is.

Robin2:

  1. Yes of course - otherwise it could not communicate over the USB cable. On an Uno (for example) there is a second microprocessor that actually handles the USB communication.

  2. I have no idea, but it seems an irrelevant question as an Arduino is not nearly powerful enough to handle video. Video is complex technology that uses a lot of very complicated compression to reduce the required bandwidth.

  3. I suspect the reason is the same as for 2 - the Arduino would not be fast enough or have enough memory.

  4. I may not understand your question. When you connect a device to a PC using a USB cable the PC operating system needs to identify it and choose the correct driver software to facilitate the communication with the device. You could think of the driver as the equivalent of a human language interpreter at a multi-national meeting.

...R

  1. I meant the digital /analog pins.
    2.Theres my question, why does the arduino has to do the heavy work?
    3.unless it sent those data over, unchanged.

  2. thats the thing, if a device is connected through an arduino to a pc, why does the arduino have to do the heavy lifting? cant the pc identify the device over the arduino with proper programming.
    Is it actually impossible to make this bridge invisible, that the device and the pc doesnt know that there is something between them?

kaseftamjid:

  1. I meant the digital /analog pins.

I think my answer dealt with that

2.Theres my question, why does the arduino has to do the heavy work?

What else can do the work? Perhaps you have something in mind that you have not told us

3.unless it sent those data over, unchanged.

It still would have to receive the data and re-send it.

  1. thats the thing, if a device is connected through an arduino to a pc, why does the arduino have to do the heavy lifting? cant the pc identify the device over the arduino with proper programming.
    Is it actually impossible to make this bridge invisible, that the device and the pc doesnt know that there is something between them?

How could a PC possibly identify a device that is connected to an Arduino rather than to the PC? Again, I suspect you have something in mind that you have not told us and, even so, I think my answer to your original question 3 applies.

Rather than expect useful answers to theoretical questions why don't you describe the project you would like to create. That will make it much easier to point you in the right direction - which may be a Raspberry PI

...R

Robin2:
I think my answer dealt with that
What else can do the work? Perhaps you have something in mind that you have not told us
It still would have to receive the data and re-send it.
How could a PC possibly identify a device that is connected to an Arduino rather than to the PC? Again, I suspect you have something in mind that you have not told us and, even so, I think my answer to your original question 3 applies.

Rather than expect useful answers to theoretical questions why don't you describe the project you would like to create. That will make it much easier to point you in the right direction - which may be a Raspberry PI

...R

1.I find it kind of surprising.. Can an arduino pin really keep up with the 480MHz frequency of the usb2.0?

  1. I actually dont have a project in mind per se, but it would be awesome if this existed.

So heres whats on my mind.

Lets say a certain usb device is being used.
So things go like this.
Connect device to usb port --> the usb protocol allows some current for the device to power up -->(1) the device sends some information regarding itself --> (2)The computer then chooses how to talk with it through drivers -->(3) sends commands -->the device acts accordingly -->(4)sends some data back.

Why cant it be like this,

The device is setup with the arduino, there is another arduino/program on a wireless capable computer that feeds wireless data through as if it was receiving data through usb port, as an usb emulator.

So what would happen is,

  1. The arduino provides power to the device for powerup.
    2.the device wakes up and sends some data about itself.
    3.!! The arduino doesnt try to make sense of the data, instead it sends the data over to the pc.
    4.fed the data through an emulator, the pc acts as if the device was connected to itself.

I cant see why this is improbable, whats stoping this from happening.

Ps.I just got the usb manual, will start reading tonight

kaseftamjid:
1.I find it kind of surprising.. Can an arduino pin really keep up with the 480MHz frequency of the usb2.0?

This is getting very tedious. It seems as if you did not carefully read my Reply #1

  1. I actually dont have a project in mind per se,

Then it is all imaginary.

...R

Robin2:
This is getting very tedious. It seems as if you did not carefully read my Reply #1
Then it is all imaginary.

...R

Everything is imaginary, electricity was imaginary, the internet was imaginary, dark matter is imaginary. But that doesnt stop people does it?

I think you got my question wrong. Im not talking about the usb to serial Ftdi chip on the arduino itself. Im talking about the pins of the atmel processor itself.

Im sorry if its bothersome

kaseftamjid:
I think you got my question wrong. Im not talking about the usb to serial Ftdi chip on the arduino itself. Im talking about the pins of the atmel processor itself.

Some Atmel chips can deal with USB (such as the 32U4 in a Leonardo) and some can't (such as the 328 in an Uno).

Going back to what I said in Reply #1, my genuine Uno has a 16U2 to deal with the USB stuff.

You need to study the datasheet for a specific chip.

...R

Maybe you could write a 'Software USB' library that would work on any pair of pins.

USB's D+/D- are low level differential pins in a shielded cable.
The low level is around 0.8V, the high level is around 2.5V.

USB 2.0 works at high speeds:

"The now-aging USB 2.0 standard can theoretically transfer data at a very high 480 megabits per second (mbps), or 60 megabytes per second (MBps)."

The Atmega16U2 used as the USB processor chip has the hardware built-in to interface with USB 2.0, as does the 32U4 that is the microcontroller of the Leonardo and the like.
They have built in hardware that takes the 12MHz or 16 MHz oscillator input and crank it up to work with the fast USB signals.

Atmega328P, 1284P, 2560, do not have differential inputs.
With 16 MHz clock, the datasheet shows the fastest serial rate is 2 MHz.
SPI uses 8 MHz clock.
Both are inadequate to deal with USB speeds.

Okay, first of all, this website needs a major revamp. It took me over 15 minutes to figure how i can reply to a post ive already seen...

CrossRoads:
USB's D+/D- are low level differential pins in a shielded cable.
The low level is around 0.8V, the high level is around 2.5V.

USB 2.0 works at high speeds:

"The now-aging USB 2.0 standard can theoretically transfer data at a very high 480 megabits per second (mbps), or 60 megabytes per second (MBps)."

The Atmega16U2 used as the USB processor chip has the hardware built-in to interface with USB 2.0, as does the 32U4 that is the microcontroller of the Leonardo and the like.
They have built in hardware that takes the 12MHz or 16 MHz oscillator input and crank it up to work with the fast USB signals.

Atmega328P, 1284P, 2560, do not have differential inputs.
With 16 MHz clock, the datasheet shows the fastest serial rate is 2 MHz.
SPI uses 8 MHz clock.
Both are inadequate to deal with USB speeds.

Does that mean theoretically the only bottleneck is the operating frequency in this specific case?
I think then usb 1.1 'should' be fine.

Moreover, if i opt to use an arduino pro, is this achievable? If so, why dont we see it that much?

And about cranking up the frequency, im unfamiliar with anything like this. If it was so easy, then external oscillators wouldn’t be so vastly used, the internal could be cranked up. Could you please refer to some additional reads?

Soft serial library,... Nice, could be useful

kaseftamjid:
Okay, first of all, this website needs a major revamp. It took me over 15 minutes to figure how i can reply to a post ive already seen...Does that mean theoretically the only bottleneck is the operating frequency in this specific case?
I think then usb 1.1 'should' be fine.

Moreover, if i opt to use an arduino pro, is this achievable? If so, why dont we see it that much?

And about cranking up the frequency, im unfamiliar with anything like this. If it was so easy, then external oscillators wouldn’t be so vastly used, the internal could be cranked up. Could you please refer to some additional reads?

This is getting more imaginary all the time

...R

Robin2:
This is getting more imaginary all the time

...R

Why do you continue to imply this is imaginary? Am i missing something?

kaseftamjid:
Why do you continue to imply this is imaginary? Am i missing something?

Yes. A specific case in which you actually need to use a USB connection and are having trouble with it.

...R

Robin2:
Yes. A specific case in which you actually need to use a USB connection and are having trouble with it.

...R

...
This is not for a project per se, but could be really really useful. Im just running the facts here so i can spend time on the useful stuff.

You seem a bit irritated by my questions?

kaseftamjid:
Im just running the facts here so i can spend time on the useful stuff.

You seem a bit irritated by my questions?

To my mind the part I have highlighted tells me that you don't care about wasting my time on useless stuff so you can save your time for the useful stuff.

Is it surprising if I am irritated?

...R

I can understand the irritation, you seem to want to use a ATmega328 (or similar) for direct connection of USB, but your not making yourself clear at all.

The question was so basic, we lost track

srnet:
I can understand the irritation, you seem to want to use a ATmega328 (or similar) for direct connection of USB, but your not making yourself clear at all.

Thats all there was to it,
If the frequency is below arduinos limit, it can deal with it right?

I believe no one is bound to answer, its just the one asking who has the burden to know

kaseftamjid:
The question was so basic, we lost track
Thats all there was to it,
If the frequency is below arduinos limit, it can deal with it right?

Did you actually read Replies #8 and #10 ?

If not, what was the point wasting time writing them?

...R