Hello,
I am trying to deinitialize the USB and USBPHY peripherals after the usb cable got detached from the processor. Because I copied the code from initialization I had the following line of code to stop USBPHY (only changed from clear to set)
USBPHY->CTRL_SET = USBPHY_CTRL_SET_SFTRST_MASK | USBPHY_CTRL_SET_CLKGATE_MASK;
With this line the core shows some unexpected behaviour: IAR EWARM/Jlink SOMETIMES show the following message

I don't know what the processor is doing if the error happens I had to restart debugging every time.
---- "WORKAROUND"
In the above shown line it does not really make sense to set SFTRST and CLKGATE at the same time because if you set SFTRST the USBPHY clock will be gated automatically.Therefore if you use the following line instead of the line above everything works as expected.
USBPHY->CTRL_SET = USBPHY_CTRL_SET_SFTRST_MASK;
What happens to the processor and USBPHY if you set the bits SFTRST and CLKGATE of USBPHY CTRL register at the same time?
Kind regards,
Stefan