2013-10-04 08:53 AM
Hi All,
i'm using STM32F407 in USB CDC mode, i'm having issue when i'm sending bytes from STM to PC, client application on PC is minicom, issue is when i close minicom and STM runs into ''frozen'' state until i open minicom again, and after opening minicom everything continues in normal running state, is there a way how to detect that client application is closed ? so i will stop sending bytes to PC, i found that STM got Ctrl call with Cmd 0x22 when i close minicom and same code 0x22 when i open minicom :( Thanks for all replies, Kind regards,2015-02-09 04:28 AM
Hi all,
I have the same question. I'm interested to detect ''connection'' and ''unconection'' from virtual COM from Hyperterminal o similar...If anyone could help us.... I'd be pleased.Thank you in advance,Best regards.Jai.2015-02-23 01:39 AM
anyone could give me a hand about this issue?
I need to detect when host PC open and close an hyperterminal (o similar) the virtual COM.Thanks in advance!Best regards.2015-02-26 01:20 AM
There is probably a better way by hacking the lower layers, but I was able to do this using a simple state machine in theTEMPLATE_Control callback in usbd_cdc_if_template.c file...
Set host_connected_cnt to 0 in theTEMPLATE_INIT() function then...case
CDC_SET_CONTROL_LINE_STATE:
// get this on connect and disconnect no way to distinguish
// also get it on intial setup and cable connect disconnect
host_connected_cnt++;
host_connected= (host_connected_cnt&1) == 0;
if
(host_connected) dispatch(
''\030connected''
, 10);
break
;
This seems to work even when you connect/disconnect the cable then connect the terminal to the CDC.
2015-03-13 06:30 AM
Hello,
could you please explain what exactly do the functiondispatch(
''\030connected''
, 10);
I have the problem when I close the COM port from PC app. The app return exception: device is in invalid state. Afterward the USB device has to be restarted in order to be able to communicate. Can anyone please help me with this issue?
Thanks in advance.
Tony