Using CDC to transmit data between PC and  M52223EVB via USB

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

Using CDC to transmit data between PC and  M52223EVB via USB

1,567 Views
K8Lxqg
Contributor I

Hi!

 

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 */
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
/* Standard IO is only possible if Console or UART support is enabled. */
#include <stdio.h>
#endif

int main(void)
{
    int receive;
   
#if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)
    printf("Hello World in C from MCF52223 derivative on M52223EVB board\n\r");
    fflush(stdout);
#endif

while (1)
{
    receive=cdc_getch();
    if (receive != 0)
    printf("%d",receive);  //printf works when I send a constant
   
}
Labels (1)
0 Kudos
Reply
5 Replies

688 Views
PaoloRenzo
Contributor V

Hi

 

What did you change? This is already available with the CDC example as it is, right?

0 Kudos
Reply

688 Views
K8Lxqg
Contributor I

Hi Paolo,

 

I just tried to use cdc_getch() function in the main. I added the files from the folder CMXUSB_LITE/usb-common and the file cdc_usb_config.h from CMXUSB_LITE/usb-peripheral to the project in order to run the function. I just made small modifications in some #include commands like #include "cdc_drv/usb_cdc.h" -->  #include "usb_cdc.h" and got rid of the errors. I'm not sure if what I am doing is sth noble, but I receive more errors that I cannot solve when I include the rest of the files in usb-host, for example.

 

Is there a CDC example that I need to know?

 

Thanks in advance,

 

Teoman

0 Kudos
Reply

688 Views
PaoloRenzo
Contributor V

Just to make sure I got your point:

 

You're trying to use the CDC peripheral example already included with the CMX example as it is but using your own CW template? Or what are the trying to attempt? What are the changes between your version and the CMX one?

0 Kudos
Reply

688 Views
mjbcswitzerland
Specialist V

Hi

 

For alternative CDC solution see also:

Coldfire USB CDC user's guide with RS232<->USB and firmware upload support. Full details at http://www.utasker.com/kirin3.html

 

Regards

 

Mark

 

 

www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."

 

 

0 Kudos
Reply

688 Views
K8Lxqg
Contributor I

Hi Mark,

 

Thanks for the links, I will update you whenever I have sth.

 

Regards,

0 Kudos
Reply