Datasheet
SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
1204
49.3.9 USB High Speed Host Port (UHPHS) and Device Port (UDPHS)
49.3.9.1 UHPHS/UDPHS: USB Does Not Start after Power-up
The USB may not start properly at first use after power-up.
Booting out of the internal ROM fixes this issue because the workaround below is applied in the ROM Code.
Problem Fix/Workaround
There are two possible workarounds:
1. Apply a hardware reset (NRST) after power-up
or:
2. Activate the PLLUTMI twice, following the procedure below:
a. Start The UTMI PLL an wait for the PLL lock bit
b. Disable the UTMI PLL and wait 10 µ seconds minimum
c. Restart the UTMI PLL and wait for the PLL Lock bit
Below is a possible implementation of the workaround:
/* First enable the UTMI PLL */
AT91C_BASE_PMC->CKGR_UCKR |= (AT91C_CKGR_UCKR_PLLCOUNT & (0x3 << 20)) |
AT91C_CKGR_UCKR_UPLLEN;
tmp =0;
while (((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_SR_LOCKU) == 0) && (tmp++ <
DELAY));
/* Disable the PLLUTMI and wait 10µs min*/
AT91C_BASE_PMC->CKGR_UCKR &= ~AT91C_CKGR_UCKR_UPLLEN;
tmp = 0;
while(tmp++ < DELAY2); // DELAY2 must be defined to fit the 10 µs min;
/* Re- enable the UTMI PLL and wait for the PLL lock status*/
AT91C_BASE_PMC->CKGR_UCKR |= (AT91C_CKGR_UCKR_PLLCOUNT & (0x3 << 20)) |
AT91C_CKGR_UCKR_UPLLEN;
tmp =0;
while (((AT91C_BASE_PMC->PMC_SR & AT91C_PMC_SR_LOCKU) == 0) && (tmp++ <
DELAY));