This may or may or may not be related, but I am having problems with opening serial ports between simple terminal apps like TeraTerm and a C# windows program that utilizes the Serial Port API within Visual Studio.
I've tracked this problem down to code in the top part of USB_Notif_Callback. This start_transactions variable only gets set if there is an event_type = 24 (USB_APP_CDC_DTE_ACTIVATED). Although this makes good sense, opening up a port in Visual Studio sends a sequence (three times) of 22, 23. (USB_APP_CDC_CARRIER_ACTIVATED), (USB_APP_CDC_DTE_DEACTIVATED). If event_type = 24 is never sent, then the port will stall on attempting to write a character, and then throw an exception if any additional characters are send after the first.
void USB_Notif_Callback(uint_8 event_type,void* val,pointer arg)
{
uint_32 handle;
uint_8 index;
handle = *((uint_32 *)arg);
if(start_app == TRUE)
{
if(event_type == USB_APP_CDC_DTE_ACTIVATED)
{
start_transactions = TRUE;
}
...
Using TeraTerm, when opeing up a COM port sends 22 (USB_APP_CDC_CARRIER_ACTIVATED) ,24 (USB_APP_CDC_DTE_ACTIVATED), which makes good sense. So this appears to be a limitation of Visual Studio. I'm looking into how to change this behavior if at all possible within the serial windows driver.