Read register error

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

Read register error

361 Views
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 Kudos
1 Reply

256 Views
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 Kudos