BSP setting fo USB

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

BSP setting fo USB

跳至解决方案
1,288 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
881 次查看
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 项奖励
回复
1 回复
882 次查看
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 项奖励
回复