USB vs. UART communication

Questions on UARTs, and serial communication
Post Reply
olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

USB vs. UART communication

Post by olzeke51 »

Hey Y'all,
okay, USB has a technical limit of 15 feet, to meet good data/timing specs.
I am 25' away from my computer/terminal and I don't have enough extension cables OR an electronic extender.
Future goal will be about 95+ feet away.
'
I want/need to get data to/from the ARMstamp [or other USB micro-controller products] connected to a
PC/terminal app.
'
Basicchip - is there a way to 'redirect' the "printf(..)" function to a serial port - especially on the USB-centric
devices?? . . I am trying to save having to write a 'printFF.bas' subroutine !!!!
What say you??
Thanks, Gary Olzeke51



olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: USB vs. UART communication

Post by olzeke51 »

Okay folks, did some more research.....
Basicchip has provided the SPRINTF function that will do the heavy lifting.
from the example in the Help file::
. "str = SPRINTF("%c%c a string a....."
.
so now you can do a TXD(x) on each character of the "str"
I had just been using the 'printf' function ;)
.
Thanks for thinking ahead there, Basicchip :D
'
"case closed" as a PI would say...

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: USB vs. UART communication

Post by basicchip »

When you get to 95 feet, simple TTL might not cut it, too noisy.

But RS-485 differential transceivers would handle it and more.

olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: USB vs. UART communication

Post by olzeke51 »

uhh,
Is there a way to get input on the USB channel as if it was a serial uart?? similar to RXD(x)
'
CASE: LPC54005 dev board: wanted to use the USB connected to a PC as terminal
printf will work for outgoing, I assume I need to use DEBUGIN stuff$ ..then parse it(if I have just numbers)
but also wanted the ability to do 'blobs' {read - binary} bigger than 256 bytes [like a file ?? ?Intel hex?
'
Any words of wisdom/experience for us, BasicChip?
Thanks for consideration,
Gary Olzeke51

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: USB vs. UART communication

Post by basicchip »

works like the ARMstamp, RXD(0) gets input from the USB serial port when it is the debug port.

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: USB vs. UART communication

Post by basicchip »

The serial interface is defined as a byte 0..255 interface or -1 when no byte is available

Yes you can send any byte to the ARM, but BASICtools does some filtering on input characters. You should use TclTerm or something similar to send binary bytes.

xldaedalus
Posts: 1
Joined: Sun Aug 28, 2022 9:25 pm

Re: USB vs. UART communication

Post by xldaedalus »

It's not cheap, and not as fun as making your own with RS485, but a USB Extension cable should solve your problem. USB uses a form of "differential" signaling. One wire puts the digital "bit" on two wires. On goes positive (D+) with the "bit" and the other goes negative (D-). The USB transceiver only cares about the difference between the two wires. As long as the difference is >100mV(depending on USB tranceiver quality) the data will come out as the same clean HIGH and LOW bits that went in. It down so that electric noise inducted into the wires is ejected. Because the data rate spec on USB is so high, and depending on your app, the data rate at high frequency falls off rapidly with distance. Hence the 15' limit for most USB 2.0.

RS485 is also a "differential" method, just more robust and usually lower data rate. It's the best way to send data long distances with high reliability. At a low data rate, but still fast enough for most applications, 56kbps will go 3000', and around 10Mbps at 100'.

100' USB extension cable It kind of does this kind signal transfer for you. I've never used one, but know you may run into issue with voltage drop if you have much more than 50mA power draw on your remote device. If you are powering the remote board, it may not be an issue, just be sure the remote USB is 5v.

https://www.amazon.com/100-ft-usb-cable ... +usb+cable

Post Reply