8 Replies Latest reply on Jul 31, 2012 4:52 PM by userc_42091


      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?

        • 1. Re: USBUART

          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.





          • 2. Re: USBUART

            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.

            • 3. Re: USBUART

              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.

              • 4. Re: USBUART

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

                • 5. Re: USBUART

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

                  • 7. Re: USBUART

                    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.





                    • 8. Re: USBUART

                      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,



                      1 of 1 people found this helpful