Read register error

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

Read register error

749 次查看
bradm
Contributor I

I am not able to figure this when stepping through the code, as soon as the debugger processes status = USB0_ISTAT I get an unhandled interrupt.   I can hover over the USB0_ISTAT and get the value of it but I am not able to do anything with it in code?

uint8_t status;

       status = USB0_ISTAT;

I can also add USB0_ISTAT to the expression window and the value shows up without any issue.

0 项奖励
回复
1 回复

644 次查看
isaacavila
NXP Employee
NXP Employee

Hello Brad,

USB0_ISTAT register should be read correctly only if USB clock gate was enabled before.

Remember that USB can be fed from USB_CLKIN or MCGFLLCLK/MCGPLLCLK/IRC48M (selected in SIM_SOPT2) but you need to enable clock gate control in SIM_SCGC4 register:

SIM_SCGC4  |= SIM_SCGC4_USBOTG_MASK;

Hope this helps!

Regards,

Isaac

0 项奖励
回复