usb cdc host demo

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

usb cdc host demo

2,077 Views
kooroshhajiani
Contributor III

Hi,

I'm running the USB CDC HOST demo on TWR-K64F120 + TWR SER2 board.

To test the demo the documentation calls for another TWR-K64F120 board configured as USB CDC device.

Since I have just that one board ,I decided to attach a USB_RS232 bridge and see if at least the HOST would attach and numerate by placing breakpoints at relevant locations in the code.

So I connected the Bridge to the Host_only USB(type A) connector on SER2 board .I shunted J16 and J21 to

Connect USB VBUS OC and USB VBUS EN to Elevator.

This is not working for me. I noticed that when I connect the USB-RS232 bridge to a host PC, power is supplied to it by the PC however when I connect the device to my board there is no power applied to the device.

maybe this is the issue, I'm just reaching.

I've also noticed that all my questions on USB have gone unanswered ,Don't know why.

Please I need all the help I can get.

Thanks,

Koorosh Hajiani

0 Kudos
15 Replies

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh,

Yes, they should be compatible between them, I thought you were using another bridge that maybe was not compatible with Host's example.

Let me try this example on my side and let you know if something else is discovered!

Regards,

Isaac

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Thanks,

I appreciate it.

Koorosh Hajiani

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh,

I ran a quick test on TWR-K64F120M board as USB CDC Host and FRDM-K64F board as USB CDC device, both are using KSDK 1.3 examples and Host detects the device correctly, I am using default USB connector (J17) instead of TWR-SER (or TWR-SER2) due I've not populated R522 and R523.

pastedImage_0.png

Have you tested the example by using an USB OTG connector on J17 and then connecting the device here instead of using TWR-SER2?

Note: it is necessary to enable VBUS because it is connected to VREGIN pin in TWR-K64F120M, and this value is needed for USB  functionality.

VREGIN.jpg

Hope this helps,

Regards,

Isaac

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Hi Issac,

I got another TWR_K64 board from a colleague  . So at this point the following project is running on a TWR_K64 board as a host:

C:\Freescale\KSDK_1.3.0\examples\twrk64f120m\demo_apps\usb\host\cdc\cdc_serial\bm\kds

and Device is running on the other TWR_K64 target from the folder:

C:\Freescale\KSDK_1.3.0\examples\twrk64f120m\demo_apps\usb\device\cdc\virtual_com\bm\kds

when I connect them to each other either as the host stand alone using Micro to USB otgo adaptor or via SER2  (remember two resistor are populated) I still can not attach .

I know you mentioned that you did get them to attach.

Any Ideas ?

Regards,

Koorosh Hajiani !

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh,

I tested by using TWR-K64F120M as Host and FRDM-K64F as Device, attachment could be detected correctly, however, I didn't test by using two tower boards.

Have you tested USB Host MSD example? I would recommend to test a simple Host MSD example and connect an USB thumb instead of two board that could be causing a problem due hardware settings (or any other initialization that could fail). Also, you can debug your project as Host and see if host stack is initialized correctly.

Hope this helps!

Regards,

Isaac

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

It will pass the initialization phase but it does not attach the device:Capture_terminal.PNG

My project needs a K64 communicating to k20 . So why do I need to test MSD?

Regards,

Koorosh

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh,

I testes the host_cdc example in TWR-K64F120M with J26 and J23 on (and software is using PTC8 and PTC9 to enable VBUS, this is default configuration for example) and on device's side, I am using a FRDM-K20D50M board and it is detecting and sending commands correctly (although, sometimes it get crash after sending some data to device).

I am using device example that is located at USB stack 4.1.1: <Freescale USB Stack v4.1.1_PATH>\Source\Device\app\cdc\cw10\kinetis_k20. Please notice that i am doing a workaround in device side in order to send data to host although it is being detected as it is by default.

CDC example.jpg

Please check default jumper configuration on TWR-K64F120M.

I hope this can help!

Regards,

Isaac

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hi Koorosh,

It will serve you to test if your hardware settings and Host software are configured correctly, because it is strange that USB CDC device is not being detect whenever you are using TWR-K64F120M or MK20's target.

I will try to connect a FRDM-K20D50M board to my current example and see if this works.

Regards,

Isaac

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Hi issac,

I thought you may be interested to know about the following test that I did .

I have a TWR-K20D50M and a K20DXX50 production board. As you know by now I have been using the production board as a CDC device with a TWR-K64 as a CDC HOST and could not get them to talk.

So I instead of TWR_K64 as a host ,I tried to use TWR-K20D50M as a CDC-HOST flashed from the following folder:

C:\Freescale\Freescale USB Stack v4.0.3\Source\Host\examples\cdc_serial\iar_ew\kinetis_k20\MK20DX128xxx5_INT_FLASH\Exe

and the K20 DEVICE is attached.

In short K20 Host talks to K20 device but K64 Host does not talk to K20 device.

We need to get to the bottom of this and find out what is going on.

Regards,

Koorosh Hajiani

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Hi Issac,

Many Thanks for your response.

I went to RadioShack and got the adaptor and connected the device directly to J17 micro connector TWR-SER2 is not attached.

Still no luck, can not attach.

The difference between my set up and yours is that your device is also a k64 target while my device is k20 target and flashed with the code from the following folder:

C:\Freescale\Freescale USB Stack v4.0.3\Source\Device\app\cdc\iar_ew\kinetis_k20\MK20DX128xxx5_INT_FLASH\Exe

I am not certain that if this is the issue.

If you have a k20 board or TWR-K20D5M board you can try it and see.

As always I appreciate your help.

Regards,

Koorosh Hajiani

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Hi Issac,

I don’t have the cable

I have to get a Micro USB to USB OTG adaptor cable, Is this what you mean? and then connect the device to it and see if it works.

In that case couple of jumpers need to be OFF or may be not?

I’ll let you know.

Thanks,

Koorosh

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh,

You will need to configure jumper in its default configuration and control VBUS by using PTC8 and PTC9 (as it is by default).

Please, let me know the results from your test!

Regards,

Isaac

0 Kudos

1,344 Views
isaacavila
NXP Employee
NXP Employee

Hello Koorosh

What example are you using? (KSDK, MQX, etc)

By default, TWR-K64F120M board uses the on board J17 USB connector for its USB functionality, if you want to use TWR-SER or TWR-SER2 board you need to populate the R522 and R523 resistors just as shown below:

Populate R523 and R522.jpg

These two resistors are located at TWR-K64F120M's bottom side.

Also, in standalone implementation, PTC9 and PCT8 pins (along with J23 and J26 jumpers) are used to enable USB VBUS when working on USB Host mode

VBUS_ENABLE.jpg

but in TWR-SER2 (or TWR-SER board), GPIO6 and GPIO4 (A35 and B35 connections in Elevator) are needed, so software should use PTB9 and PTB8 instead of PTC9 and PTC8 when using TWR-K64F120M and TWR-SER(2) boards.

VBus enable in TWR-SER2.jpg

If these considerations are already met, I would recommend to test a Host MSD example instead of CDC Host, this way you can see if detection problems are caused due CDC device is not supported by Host CDC example or it is a hardware issue.

I hope this can help you!

Regards,

Isaac

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

Hi Isaac,

I tried your recommendation as follows:

Populated R522 and R523.

Configured PB9 as output and drive it low at the initialization to enable the USB power.

PB9 is input to monitor over current.

Unfortunately it is not working and still the host still does not attach the device.

I believe my jumpers setting are correct :

J21,J16 on SER2 shunted.

J24 SER2 un-shunted.

J26,J23 ON TWR_K64 SHUNTED (not sure about this one since SER2 is used)

J25 TWR-K64 No ID selection USB Host / Device

K64 VREG IN Selector shunts 2_3 (twr-k64)

Do I really need the VBUS to supply power to the device? As I said my K20 is running as a device and powered by an external source.

You also recommended to use a HOST-MSD, I will do that however the CDC_HOST demo in KDS and CDC_DEVISE code in USB STACK are not a match?

One would think that the host should support the device in this case!!!!

Please let me know If anything jumps out at you.

Many Thanks,

Koorosh Hajiani

0 Kudos

1,344 Views
kooroshhajiani
Contributor III

isaacavila,

Many Thanks,

Great information. I'm using SDKI.3. I've the CDC_SERIAL_HOST running on TWR_64K+SER2 and was able to build the code in USB STACK 4.0.3 for CDC_DEVICE for K20 (SDK does not support K20 targets) using the IAR compiler and download it to my k20 target using KDS +Multilink PE ) This is a very convoluted process.

when I plug the device(k20 target) into the PC ,I see the usual message "device found" and tries to download the driver which does not even exist.

However when I connected it  to my HOST running on TWR_64k+SER2 board ,it  never attempt to attach the device.

It could very well be due to the facts you pointed out.

I will try to follow your suggestions and will let you know if it works.

Regards,

Koorosh Hajiani   

0 Kudos