Can detect the open/close in USB CDC ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Can detect the open/close in USB CDC ?

2,008 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dive on Fri Nov 19 00:45:32 MST 2010
I use LPC1343 with example source [usbcdc] modified a little.
I want to detect the open/close of the host application (like hyper terminal)

LPC1343-----usb-----PC(hyper terminal)

Connection sequence is

1. Connect the USB cable between LPC1343 and PC.
   Enumeration started, then USB vcom ready.
2. Start up the hyper terminal in PC, then open the vcom port.
   *** I want to know this event in LPC1343 ! ***
3. Close the vcom port in hyper terminal.
   *** I want to know this event in LPC1343 ! ***
4. Disconnect the USB cable.

Run the lpcxpresso debugger and found that CDC_GetLineCoding and
CDC_SetLineCoding functions are called at this timing.
But it's not enough information...

Does anyone know about it ?
0 项奖励
回复
4 回复数

1,757 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by domen on Sun May 01 12:28:36 MST 2011
Or it could mean DTR line is used for some other purpose, which isn't unusual :P
0 项奖励
回复

1,757 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Mon Nov 22 06:07:56 MST 2010
If DTR goes inactive that means that someone wanted to disconnect. Hyperterminal does this only automatically. Other terminals with diag functions allow for user control. Anyway DTR inactive means "disconnect". If someone deactivates DTR he means precisely that -  disconnnect. So - don't worry.
0 项奖励
回复

1,757 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dive on Sun Nov 21 18:54:40 MST 2010
Thank you very much , gbm.:)

It's good idea to check the DTR (and RTS) state.
I didn't know this.

But it can not detect the event correctly when the user change the DTR state directly via the hyper terminal (or Terminal Software that can adjust the Control line ).

DTR goes inactivate ->  Port closed ?   or   User changed the DTR state ?

:(
0 项奖励
回复

1,757 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gbm on Fri Nov 19 02:09:21 MST 2010
When the terminal opens, it activates DTR and RTS; while closing these signals go inactive (actually RTS may toggle when transferring the data). The state of these signals is reflected in CDC messages.
0 项奖励
回复