I have tried to run the USB CDC HOST and CDC DEVICE demo in SDK 1.3 , using 2 TWR_64K and KDS3.0 with no luck. I just pass the initialization phase and DEVICE is never attached. A very gracious user named ISSAC has been helping me tremendously but it just refuses to attach the device. If any one have some thoughts, Please let me know.
So I decided to run the similar demos Freescale_BM_USB_Stack_v5.0 using IAR platform.
I'm trying to build the project from the following folder:
C:\Freescale_BM_USB_Stack_v5.0\Src\example\host\cdc\cdc_serial\bm\iar\host_cdc_serial_twrk64f120m
So created a wok-space and had to add few include path This is what I get:
It is passing the compile phase however it fails in the linking phase since its looking for a library file usbh.a
in the folder shown in the output council of the workbench that does not exist . where is this file?
Any Ideas? Anyone?
Thanks,
Koorosh Hajiani
Solved! Go to Solution.
Hello Koorosh,
In USB Stack 5.0, you need to compile USB library for your host application, it is located at: <Freescale_BM_USB_Stack_v5.0>\Src\usb_core\host\build\iar\usbh_bm_twrk64f120m. After building the USB Host library, you will be able to compile your project correctly.
Hope this helps!
Regards,
Isaac
Hello Koorosh,
In USB Stack 5.0, you need to compile USB library for your host application, it is located at: <Freescale_BM_USB_Stack_v5.0>\Src\usb_core\host\build\iar\usbh_bm_twrk64f120m. After building the USB Host library, you will be able to compile your project correctly.
Hope this helps!
Regards,
Isaac
Hi Isaac;
I had to leave USB implementation for a while to do some other embedded task and now I'm back again.
So I was able to get the HOST from:
C:\Freescale_BM_USB_Stack_v5.0\Src\example\host\cdc\cdc_serial\bm\iar\host_cdc_serial_twrk64f120m
to attach the device from SDK:
C:\Freescale\Freescale USB Stack v4.0.3\Source\Device\app\cdc\iar_ew\kinetis_k20
Now as you know I'm a novice when it comes to USB. So my goal is to send just a few bytes from host to device and visa versa .
I see a function named
_io_cdc_serial_write_async ,Is this the function to call for that purpose? I placed a break point on this function but it never hits.
one last thing when I type characters in my terminal before I press enter, They're echoed back on screen My local echo on my terminal is off.
Thanks,
Koorosh Hajiani
Hello Koorosh,
About characters being echoed, in cdc_serial.h there is a macro to enable/disable echo in serial terminal:
#define CDC_SERIAL_ECHO_BACK (1)
So you need to set it to 0 in order to disable echoing back.
For CDC example, progam is reading data from UART (serial terminal) and they are stored in a buffer that will be sent to USB later. This data is sent by using:
num_done = _io_cdc_serial_write(s_f_usb_info.f_usb, &usb_tx_buf[usb_tx_done], (send_cnt > CDC_MAX_PKT_SIZE? CDC_MAX_PKT_SIZE : send_cnt));
In this case, s_f_usb_info.f_usb is the FILE PTR to write to USB module, usb_tx_buf[] is the buffer where the data is stored and third parameter specifies how many data will be sent.
I hope this can help!
Regards,
Isaac
Thanks Issac.
Yes you’re right, I forgot to do that.
Regards,
Koorosh