Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Detecting if USBUART is connected

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Detecting if USBUART is connected
Moderator:
ANCY

Post Reply
Follow this topic



Detecting if USBUART is connected

bkphat posted on 18 Jan 2013 4:38 PM PST
Senior Member
13 Forum Posts

 Hi, when my program starts it checks to see if a PC is trying to talk to it over the USBUART components. Presently I just do a delay for a few seconds and wait for incoming data. If I don't hear any, I boot the rest of the software. This is kind of a waste though since it waits. In most cases the board won't be connected to a PC. Is there a way to detect if a USB cable is connected or if there is a clinet on the other end?

Thank you,

bk




Re: Detecting if USBUART is connected

danaaknight posted on 19 Jan 2013 04:25 AM PST
Top Contributor
1773 Forum Posts

I have no magic bullet here. But some general thoughts.

1) First is it a full RS232 connection, or just 3 wire ?

2) Depending on connection completeness could you use a pullup or pulldown to detect ?

SignalOriginDB-25 pin
NameTypical purposeAbbreviationDTEDCE
Data Terminal ReadyIndicates presence of DTE to DCE.DTR? 20
Data Carrier Detect DCE is connected to the telephone line.DCD ?8
Data Set ReadyDCE is ready to receive commands or data.DSR ?6
Ring IndicatorDCE has detected an incoming ring signal on the telephone line.RI ?22
Request To SendDTE requests the DCE prepare to receive data.RTS? 4
Clear To SendIndicates DCE is ready to accept data.CTS ?5
Transmitted DataCarries data from DTE to DCE.TxD? 2
Received DataCarries data from DCE to DTE.RxD ?3
Common Ground GNDcommon7
Protective Ground PGcommon

 


3) Detect a ground loop when cable is conencted ?


 


Just some thoughts.


 


Regards, Dana.



Re: Detecting if USBUART is connected

Bob Marlowe posted on 19 Jan 2013 06:40 AM PST
Top Contributor
1768 Forum Posts

Dana, I'm afraid a PSoC5 USBUART neither got a RTS, CTS and even a RS or Tx signal.

On the PSoC side it acts like an USB connection and on the PC-side it is ttranslated by the OS (rather: faked) into a serial com-port.

 

Bob



Re: Detecting if USBUART is connected

danaaknight posted on 20 Jan 2013 04:40 AM PST
Top Contributor
1773 Forum Posts

Something like this ?

 

 

Regards, Dana.



Re: Detecting if USBUART is connected

Bob Marlowe posted on 20 Jan 2013 07:25 AM PST
Top Contributor
1768 Forum Posts

Well, the PSoC5 (and the pSoC3 of course,too) offers a component named USBUART and since this is the PSoC5 thread I presume that this would be the matter. I'm sorry, not to be able to tell whether there is a way to directly test for a connection, but since even the bootloader waits for a certain time waiting seems to be at least a practical safe method.

 

Bob



Re: Detecting if USBUART is connected

danaaknight posted on 20 Jan 2013 12:39 PM PST
Top Contributor
1773 Forum Posts

One other possibility is a connector insert switch, similiar in operation to a card

edge connector switch, that detects presesnce of card. Of course this would only

detect mechanical readiness, not electrical. This would be simplest, my suggestion

on ground loop detection is fraught with installation to installation electrical differences.

 

Regards, Dana.



Re: Detecting if USBUART is connected

hli posted on 21 Jan 2013 01:49 AM PST
Top Contributor
675 Forum Posts

There was a similar discussion here: http://www.cypress.com/?app=forum&id=2232&rID=66591

The two suggestions which came up:

  • use one of the USBUART_GetLineControl() / USBUART_CDCIsReady / USBFS_GetEPState methods
  • check for the presence of USB start-of-frame messages, and use the USBFS_bCheckActivity() method

Unfortunately there was no final resolution in this thread...






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20