12.1.5 SAM-BA Monitor
This part of the ROM code is executed when no valid code is found in any NVM during the NVM boot sequence, and if the MON_DIS field is not set to 1 in the Boot Configuration packet.
The main RC oscillator is used as the Main Clock. To configure the USB clock, the Main Oscillator is enabled by setting the CKGR_MOR.MOSCXTEN and CKGR_MOR.MOSCSEL bits. Then the external quartz detection is started. This detection is successful when the MOSCXTS bit rises, else the USB is not activated and only UART is used in SAM-BA Monitor.
If an external clock or crystal frequency is found, then the UPLL is configured to allow communication on the USB link for the SAM-BA Monitor.
The SAM-BA Monitor steps are:
- Initialize UART and USB.
- Check if USB Device enumeration occurred.
- Check if characters are received on the UART.
Once the communication interface is identified, the application runs in an infinite loop waiting for different commands as listed in Table 12-6.