Teoman Ogan

Using CDC to transmit data between PC and  M52223EVB via USB

Discussion created by Teoman Ogan on Dec 22, 2009
Latest reply on Dec 28, 2009 by Paolo Alcantara Cadillo



I am using M52223EVB and CodeWarrior version 5.9.0 and trying to send and receive data to/from PC by USB plug-in.


I have downloaded Freescale_USB_Lite_CMX and installed it. I decided to use USB Host Demo so I created a new project and included all the files in the folders "usb-common" and "usb-host" which are present in "CMXUSB_LITE" folder. I received a lot of errors, so investigated in the codes and found two functions: cdc_getch() and cdc_putch(). I guess if I can manage to use these function correctly, I will achieve my aim. Of course I'm not sure about it.


To use the functions, I have included usb_cdc.c and and other files necessary to run usb_cdc.c and managed to make the project without errors. Now I try to receive data from PC via USB and to send it to UART0 (Sub-D 9) and observe the data in Hyperterminal (COM1). No problem in UART0 part. I use a second Hyperterminal (COM4) with the same properties (19200 bps, no parity, etc.) but I cannot receive any data via USB.


I may have problems both in hardware and software. I don't see any "Found new hardware" message when I plug in the USB. In Device Manager, I only saw two Communication Ports (COM1, COM2) and no MCF5222x CDC. I desperately changed COM2 to COM4.


Please help!


For the software part I'm posting my code to make more clear what I try to do:


#include "support_common.h" /* include peripheral declarations and more */
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>

int main(void)
    int receive;
    printf("Hello World in C from MCF52223 derivative on M52223EVB board\n\r");

while (1)
    if (receive != 0)
    printf("%d",receive);  //printf works when I send a constant