USB_APP_CDC_SERIAL_STATE_NOTIF is non-functional

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB_APP_CDC_SERIAL_STATE_NOTIF is non-functional

785 Views
dankarm
Contributor II

Using the latest Freescale Kinetis Software Development Kit (Kinetis SDK 1.2.0) for USB CDC virtual COM port, I discovered that the USB_APP_CDC_SERIAL_STATE_NOTIF operation in the example application USB_App_Class_Callback() function (see virtual_com.c in the cdc/virtual_com demo_apps examples) is non-functional. When the USB host sends the appropriate request associated with changing the RTS or DTR signals, the "data" pointer referenced is always a NULL. Without any data, it is very difficult for the user to "add your own code for serial_state notify event" as stated in the code comments.

 

Investigating this, I determined that there appears to be a problem with the USB_Service_Cdc_Notif() function in the usb_cdc.c file. In this function, the callback call (lines 434 to 438) always initializes the "data" and "size" pointers to NULL being passed to the callback function (eventually calling the application's USB_App_Class_Callback() function). I was able to get it to work by changing the following lines: (shown in bold)

 

Line
433       uint8_t event_type = USB_APP_CDC_SERIAL_STATE_NOTIF;
434       cdc_obj_ptr->class_specific_callback.callback(event_type,
435       USB_REQ_VAL_INVALID,              
436       &event->buffer_ptr,// was NULL, DLK made this bug fix
437&event->len,// was NULL, DLK made this bug fix
438cdc_obj_ptr->class_specific_callback.arg);

 

With those changes, the 10 bytes of data now available is typically similar to the following:

  0xa1 0x20 0x00 0x00 0x00 0x00 0x02 0x00 0x02 0x00

with the two least significant bits of the next to last byte determined by the RTS and DTR settings from the USB host's communications application.

 

Dan

Labels (1)
0 Kudos
1 Reply

396 Views
ivadorazinova
NXP Employee
NXP Employee

Hello Dan,

many thanks for your report. I passed it to SW team.

Best Regards,

Iva

0 Kudos