Waiting for device status
In this section:
One common construction that could cause unnecessary power consumption is to use a poll loop for waiting for a status change of, for example a peripheral device. Constructions like this example execute without interruption until the status value changes into the expected state.
while (USBD_GetState() < USBD_STATE_CONFIGURED); while ((BASE_PMC->PMC_SR & MC_MCKRDY) != PMC_MCKRDY);
To minimize power consumption, rewrite polling of a device status change to use interrupts if possible, or a timer interrupt so that the CPU can sleep between the polls.