BSP setting fo USB

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

BSP setting fo USB

Jump to solution
925 Views
Teckna
Contributor V

Hi everyone,

 

I'm working on a custom board with CW10, MQX 3.8 and K60N512 processor.

 

With this board I have successfully worked with MQX 3.7. Now that I ported all custom drivers to MQX 3.8, everything is ok except the USB. I cloned the BSP twrk60n512 and I modified the line 58 in the bsp_cm.h file from

#define CPU_XTAL_CLK_HZ                 0x02FAF080U /* Value of the external crystal or oscillator clock frequency in Hz */

to

#define CPU_XTAL_CLK_HZ                 0x016E3600U /* Value of the external crystal or oscillator clock frequency in Hz */

(my external clock is 24 MHz instead of 50 MHz as in the twrk60n512 board)

 

When I insert the USB cable in the PC port the device is not recognized, even if leave the 50 MHz define.

The only way I found to make the USB work is to set the SIM_CLKDIV2.USBDIV field to 0 instead of 1 in the Cpu_SetClockConfiguration function: I modified the line 717 in the bsp_cm.c file from

      SIM_CLKDIV2 = (uint32_t)((SIM_CLKDIV2 & (uint32_t)~0x0DUL) | (uint32_t)0x02UL); /* Update USB clock prescalers */

to

      SIM_CLKDIV2 = (uint32_t)(SIM_CLKDIV2 & (uint32_t)~0x0FUL); /* Update USB clock prescalers */

Am I right or do I have to modifiy other things?

Any other advice?

 

Many thanks

Teckna

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
518 Views
Teckna
Contributor V

I posted the same thread in MQX general board.

The topic is here.

The solution is https://community.freescale.com/message/103072#103072.

 

Many thanks

Teckna

 

View solution in original post

0 Kudos
Reply
1 Reply
519 Views
Teckna
Contributor V

I posted the same thread in MQX general board.

The topic is here.

The solution is https://community.freescale.com/message/103072#103072.

 

Many thanks

Teckna

 

0 Kudos
Reply