How do I detect that the host PC has closed a USB CDC serial port?

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

cross mob
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Hi,

I'm not as experienced on USB-related programming overall.

I happen to be using a PSoC5LP and the USBFS in UART (CDC) mode (with the USB_UART component).   I assume this question can apply to USB CDC communication in general.

The issue:

I can detect when the host PC opens a serial port using the EP0 (end point 0) interrupt service.

I'm trying to detect when the host closes the serial port.   I can also see the EP0 ISR is occurring at this time.  

I'm trying to decode what messages from the host is being sent with no real success.

I've looked on the USB 2.0 specification and cannot find any info about what requirements the host must do when informing the device on the other end that the port has just closed.

I would appreciate the help in pointing me in the right direction.  Thank you in advance.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
1 Solution
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hi @Len_CONSULTRON 

I believe this is the same issue that is being handled in the thread: https://community.infineon.com/t5/PSoC-5-3-1/Looking-for-help-on-how-to-detect-the-host-PC-closing-a...

If yes I can lock this one and we can continue the discussion in the other thread.

Best Regards
Ekta

View solution in original post

0 Likes
4 Replies
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hi @Len_CONSULTRON 

I believe this is the same issue that is being handled in the thread: https://community.infineon.com/t5/PSoC-5-3-1/Looking-for-help-on-how-to-detect-the-host-PC-closing-a...

If yes I can lock this one and we can continue the discussion in the other thread.

Best Regards
Ekta

0 Likes

@Ekta_N ,

Interesting. 

I specifically placed this post in the "PSoC 5" forum.   

I specifically placed the other post you mentioned in the "USB low-full-high speed peripherals" forum to ask the USB experts in that community.   I now find this post in the PSoC5 community.  Why?

 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

@Len_CONSULTRON 

I think someone from the   "USB low-full-high speed peripherals" community saw PSoC 5LP in the description and title and moved the thread to this space.

I have informed the team internally regarding this and they will take a look at this.

Best Regards
Ekta

0 Likes

@Ekta_N 

I could make some changes to it to make it more generic to the USB forum.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes