MQX USB CDC HOST doesn't work on FRDM-K64F

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

MQX USB CDC HOST doesn't work on FRDM-K64F

444 Views
r_letourneur
Contributor III

Hi, I have a problem to use the FRDM-K64F board with the MQX 4.1.1 USB HOST CDC example. So I have populated the resistor R72 0 Ohms for USB_ID and the strap J21 for providing power on the host usb port. So When I start the usb task nothing append on cdc_serial_event when I plug my USB CDC modem device! The modem is powered but nothing, so I have completed the DriverInfoTable with my vendor and devive id informations. It should be working. Please can anybody help me if the USB host cdc example is working on the FRDM-K64F?
Regards

0 Kudos
1 Reply

236 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Regis,

USB CDC Host example is coded to work only with the USB CDC device example. Let me explain.

- USB CDC Device example receives data from UART - CDC and sends it back (echo) to CDC - UART

- USB CDC Host example send data to the device and waits for the echo. If the same amount of data that was transmited is not received the example will get stuck. You can see this part of the code in void CDC_Task () defined in cdc_serial.c.

/* Write data to USB */

         if (uart2usb_num)

         {

            num_done = _io_cdc_serial_write(f_usb, uart2usb, (int_32)(sizeof(uart2usb[0]) * uart2usb_num));

            if(num_done > 0)

            {

                for (i = (uint_32)num_done; i < uart2usb_num; i++) /* move buffer data, remove the written ones */

                    uart2usb[i - num_done] = uart2usb[i];

                uart2usb_num -= num_done;

                char_to_recv += num_done;

            }

         }

       

         /* Read data from USB */   

         if(char_to_recv > 0)

         {      

             num_done = _io_cdc_serial_read(f_usb, usb2uart + usb2uart_num, (int_32)(sizeof(uart2usb) / sizeof(uart2usb[0]) - usb2uart_num));

             if(num_done > 0)

             {

                 usb2uart_num += num_done;   

                 if(char_to_recv >= num_done)

                 {

                     char_to_recv -= num_done;   

                 }

                 else

                 {

                     char_to_recv  = 0;

                 }

             }

             else

             {

                 char_to_recv  = 0;

             }     

         }

        

         /* write them to UART */

         if (usb2uart_num > 0)

         {

             for (i = 0; i < usb2uart_num; i++)

             {

#ifdef MCU_mcf51jf128

                 printf(" --received--> %c\n\r",usb2uart[i]);

#else

                 sci2_PutChar(usb2uart[i]);

#endif

             }

             usb2uart_num = 0;     

         }

    }

I hope this helps.

Best regards,

Carlos

Technical Support Engineer

0 Kudos