USBUART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I am using the USBUART with PSoc3 and would like to know the easiest and correct way to test if the USB connection has been lost. Can anyone help please?

0 Likes
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Since a UART-communication usually do not have signals to check for actice / lost communication you are a bit lost.

   

A way out is to write a "Protocol" which defines who may talk and who must answer, what requests are valid and what are the expected answeres of a request. So, if a request is not answered (correctly) in time the connection seems broken. This implies a timeout-timer which when overflows will abort the communications.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You might want to post in USB section of the forums, or as a tech case at www.cypress.com.

   

 

   

I saw this online as one solution - http://www.embeddedrelated.com/groups/lpc2000/show/49856.php

   

NXP ARM part, but concept there.

   

 

   

Regards, Dana.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Your best guess might be the USBAURT_GetLineControl() method. It returns the state of the DTR and RTS signals - the latter one being 'ready to send'. As long as it is true you are free to send. But even that might not distinguish between a really lost USB connection and a receiver which is just stuck and doesn't handle input anymore. USBUART_CDCIsReady seems to serve a similiar purpose.

   

If you need more low-level information, USBFS_GetEPState might help you.

0 Likes
Anonymous
Not applicable

Just wanted to say a big thanks to everyone.. your suggestions were most helpful and gratefully received. Still working on a solution.

0 Likes
Anonymous
Not applicable

hey is there any difference between uart and usb-uart?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is! (Exclamation mark)

   

A (simple) UART is a serial device sending data via one line and receiving data over another (optionally with some handshake-signals) and is usually used to built an RS232 interface which needs a level-shift to +- 12V or a current-loop interface (20mA).

   

Since USB has become more and more common there was the idea to transmit data over USB hardware and ler it look-a-like as an UART which is known in the windows-world as COM-port. 

   

So when you connect your USBUART with a simple USB-Cable (Something unthinkable in the former world of RS232: Crossover the signals or not, that's the question). The USB-device is seen as a COM-device by the driver in Windows and can be used immediately with a terminal software.

   

 

   

Bob 

0 Likes
Anonymous
Not applicable

To answer a couple questions:

   

"What is the difference between a UART and USBUART?"

   

Almost everyone knows a UART as the simple serial communication done through those big DB9 connectors. Might remember them from the old days on the back of modems. They are a simple way to stream data back and forth via a RX and TX interface. Very easy to use and very easy to configure.

   

A USBUART is very different from a UART, even though the end result is the same. The USBUART is basically the USBFS component pre-configured to conform to the Communication Device Class (CDC), which is a predefined USB class standard. How the data gets transmitted is very different as a specific USB protocol needs to be observed. Cypress has designed the USBUART component to handle all of the protocol for you, as long as you use the Cypress APIs. After all the USB stuff is taken care of, you end up with a serial COM port just like you get with a standard serial DB9 cable. As consumer devices are getting smaller and smaller, the need to eliminate the serial connectors and replace them with USB connectors are growing. Hence the need for USBUART.

   

"How can you see if the USB connection has been lost?"

   

The simplest way is to check for the USB Start of Frame (SOF) packets, which occur every 1ms. If there is no USB connection, there is no SOF packets. Using the USBFS_bCheckActivity()  API will check to see if the USB connection is still active.

   

Best Regards,

   

Robert