K53 USB CDC data rate issue MQX

Showing results for 
Search instead for 
Did you mean: 

K53 USB CDC data rate issue MQX

Contributor IV


We have a custom board with MK53DN512CLQ10 in which we are trying to analyze feasibility of using MQX based USB CDC implementation for a higher data rate.

To test the data rate achievable, I tried pushing a saved buffer say,

uint8_t recv_data[]={"C1234567D1234567E1234567F1234567G1234567H1234567I1234567J1234567"};

void Virtual_Com_App(void)
    /* User Code */
//    if(g_recv_size)
//    {
//        _mqx_int i;
//        /* Copy Buffer to Send Buff */
//        for (i = 0; i < g_recv_size; i++)
//        {
//            printf("Copied: %c\n", g_curr_recv_buf[i]);
//            g_curr_send_buf[g_send_size++] = g_curr_recv_buf[i];
//        }
//        g_recv_size = 0;
//    }
//    if(g_send_size)

        uint8_t error;
        uint8_t size = g_send_size;
        g_send_size = 0;

        error = USB_Class_CDC_Send_Data(g_app_handle, DIC_BULK_IN_ENDPOINT,
            recv_data, size);
        if (!error && !(size % DIC_BULK_IN_ENDP_PACKET_SIZE)) {
            /* If the last packet is the size of endpoint, then send also zero-ended packet,
            ** meaning that we want to inform the host that we do not have any additional
            ** data, so it can flush the output.
            error = USB_Class_CDC_Send_Data(g_app_handle, DIC_BULK_IN_ENDPOINT, NULL, 0);
        if(error != USB_OK)
            /* Failure to send Data Handling code here */

After dumping the code, I tried capturing data via real term for 10seconds onto a file. The data rate seems very low as per the observed file. I am getting 800sps as per the implementation (As per file size). This data rate changes depending on my string length and the maximum I got is 1ksps.

Am i going wrong in configuration or doing something terribly wrong? Data rate is critical for our implementation in which there will be 5 (SPI and  I2C peripherals) channels pushing out 2bytes data at say 1ksps or higher. 

Labels (1)
0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Hi annamol:

The usbd library uses Bulk endpoints. Per the usb specification, the bulk endpoints have guaranteed delivery but don't have guaranteed bandwidth. If you have an application with a requirement of guaranteed bandwidth, you will need to consider using isochronous endpoints. Unfortunately current MQX not supports this.



0 Kudos