SLAA450G April 2010 – April 2020
The USB BSL uses a routine to measure the speed of the external oscillator that is used in the application. The BSL does this by comparing the speed of the external clock to a known calibrated internal clock. In this way, the default BSL can be used without modification with certain specific external oscillator frequencies. If other frequencies are to be used in an application, the SPEED_x and corresponding SPEED_x_PLL values can be changed. They must be in order from highest to lowest speed. If only one speed will be used, all values must still be defined, but can be defined as the same frequency.
//9MHz Example Code
#define SPEED_1 9000000
#define SPEED_1_PLL USBPLL_SETCLK_9_0
#define SPEED_2 SPEED_1
#define SPEED_2_PLL SPEED_1_PLL
#define SPEED_3 SPEED_1
#define SPEED_3_PLL SPEED_1_PLL
#define SPEED_4 SPEED_1
#define SPEED_4_PLL SPEED_1_PLL
Even in the case where only one known frequency is used, as shown in this code example, it is important to keep the measurement loop in the USB Peripheral Interface, as it is also used for a delay to allow for crystal start-up.