MK20DN512ZVMC10 USB Host enumeration problem.

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

MK20DN512ZVMC10 USB Host enumeration problem.

Jump to solution
922 Views
admin
Specialist II

We've created a product on base of MK20DN512ZVMC10 and set it up properly on software level. Although, it doesn't enumerate any USB device connected to the USB port. The register TXSUSPENDTOKENBUSY is set to 1 right after the first setup packet sent over USB. SOF packets get generated and their transmission is going on over D+ and D-.

The code from khci.c which is makes this happen is following:

case TR_CTRL: 
bd_ptr = (uint_32*) BD_PTR(0, 1, usb_host_ptr->tx_bd);
*(bd_ptr + 1) = HOST_TO_LE_LONG((uint_32)buf);
*bd_ptr = HOST_TO_LE_LONG(USB_BD_BC(len) | USB_BD_OWN);
  ------>        usb_ptr->TOKEN = (uint_8)(USB_TOKEN_TOKENENDPT((uint_8)pipe_desc_ptr->G.ENDPOINT_NUMBER) | USB_TOKEN_TOKENPID_SETUP);
usb_host_ptr->tx_bd ^= 1;
break;

We've tried to run the software from RAM and from FLASH with no results. We have 2.2pF on VOUT33 so recommendations from other posts do not work. We have tested it with 3 different configurations: added external mouse, external hub, and our internal hub. The same code with the same equipment works fine on TWR-K53. We are using 8MHz external oscillator. Source code for initialization of clocks are in attachment.

Please, help to locate a problem ASAP.

Labels (2)
1 Solution
541 Views
akvarel
Contributor I

The problem is in missing initialization register.

Add

MPU_CESR=0;

before return from pll_init() function.

Also, make sure that you switch to external reference clocks.

MCG_C1 = MCG_C1_CLKS(2) | MCG_C1_FRDIV(3);

View solution in original post

2 Replies
542 Views
akvarel
Contributor I

The problem is in missing initialization register.

Add

MPU_CESR=0;

before return from pll_init() function.

Also, make sure that you switch to external reference clocks.

MCG_C1 = MCG_C1_CLKS(2) | MCG_C1_FRDIV(3);

542 Views
fernandogarcia
Contributor II

hello.

The answer is correct, I added MPU_CESR = 0; and it works, but I have another problem, when I debug everything works correctly. but off the debugger and the USB is not working. Why can this happen?

Thank you.

0 Kudos