12.5
SAM-BA Monitor
If no valid code is found in the NVM during the NVM bootloader sequence.
The Main Clock is switched to the 32 kHz RC oscillator to allow external clock frequency to be measured.
The Main Oscillator is enabled and set in Bypass mode. If the MOSCSELS bit rises, an external clock is
connected. If not, the Bypass mode is cleared to attempt external quartz detection. This detection is successful
when the MOSCXTS and MOSCSELS bits rise, else the internal 12 MHz fast RC oscillator is used as the Main
Clock.
If an external clock or crystal frequency running at 12 MHz is found, then the PLLA is configured to allow
communication on the USB link for the SAM-BA Monitor else the Main Clock is switched to the internal 12 MHz
fast RC oscillator, but USB will not be activated.
The SAM-BA Monitor steps are:
Initialize DBGU and USB
Check if USB Device enumeration occurred
Check if characters are received on the DBGU
Once the communication interface is identified, the application runs in an infinite loop waiting for different
commands as listed in Table 12-4.
Figure 12-10. SAM-BA Monitor Diagram
No valid code in NVM
External clock
detection
Init DBGU and USB
USB Enumeration
Successful?
Yes
Run monitor
Wait for command
on the USB link
No
No
Character(s) received
on DBGU?
Yes
Run monitor
Wait for command
on the DBGU link
SAMA5D4 Series [DATASHEET]
81
Atmel-11238C-ATARM-SAMA5D4-Datasheet_12-Jul-16