AnsweredAssumed Answered

How to determine that CDC VCOM was opened or closed?

Question asked by Tomáš Virtus on Feb 16, 2018
Latest reply on Mar 8, 2018 by Carlos_Mendoza

Hello.

 

I've third party board for controlling LCD display with UART control interface. The board is accompanied with Windows application that controls the board via custom protocol over the serial port (i.e. it uses Windows API to open and read from/write to a selected COM port).

 

In my final design, there's no physical serial port, but only an USB port connected to my board with LPC11U24/301. My board is also connected to the UART of the 3rd party board. So I'm trying to setup a virtual serial port over USB and forward the traffic between the control application and the 3rd party board via my board.

 

There're examples of UART <-> USB VCOM forwarding in LPCOpen sources which I copied and adapted to my needs. My problem is that the state machine doesn't account for the situation where the 3rd party board sends something and there's no reader on the USB host, e.g. no when no application is using the serial port.

 

What I need is a way to tell that the remote side has opened and closed the virtual serial port. The USB_IRQHandler is called when the virtual COM port is opened and closed in Windows, but I can't find any change in USB status registers, that would inform the firmware on MCU about this information. The IRQ handler must be called for a reason so there must be some changes I presume.

 

What should I read in USB_IRQHandler to figure out that CDC VCOM was opened or closed?

Outcomes