This Knowledgebase article describes how to determine whether the 32 MHz crystal needs to be trimmed, and the steps for performing the trim. For use with 4.1.0 SDK.
1. Guidance for determining if trimming of the 32 MHz crystal is needed
The Apollo4 Blue 32 MHz crystal accuracy requirement is 40 PPM including initial tolerance, temperature drift, and crystal aging. The crystal must be specified for operation with 6 pF load capacitance and must have an ESR of no more than 100 Ohm. Crystal initial tolerance is the main frequency tolerance in PPM specified for a crystal and specifies how much the crystal may vary from specified frequency when new, at room temp, and with specified load capacitance applied. The temperature drift will be determined by the crystal specs and is often specified as temperature stability in PPM. The crystal aging should also be specified by the crystal manufacturer in PPM per year.
For intended operating conditions (temperature) and product lifetime, the total frequency variation should be calculated by adding together the initial tolerance, temperature stability, and aging. This total frequency variance must be less than 40 PPM to guarantee that all BLE will operate reliably across temperature and over the lifetime of your product. If the calculated total crystal PPM exceeds 40 PPM there are two possible solutions:
- Select a crystal with tighter initial tolerance, temperature stability, or aging.
- Perform per-unit calibration trim to reduce the initial tolerance to a much lower PPM (limited only by production measurement accuracy used to measure the frequency and the Apollo4 Blue 32 MHz crystal trim step size.
If the crystal tolerance as described above meets the 40 PPM requirement, then a fixed per-design trim may be used. This trim value will need to be determined by measuring the initial frequency on a large population of boards (because the crystals have +/- 20 PPM tolerance) and then calculate the trim for the median frequency. This will center the 20 PPM initial tolerance of this particular board design (crystal+board) at the correct 32 MHz.
If a crystal with capacitive load spec other than the recommended 6 pF is used, then the initial frequency of the crystal will be pulled due to being operated with incorrect load capacitance. In this case, crystal trimming will be required. We only officially support use of 6 pF specified crystals with Apollo4 Blue.
Note: In all cases, the customer should test and confirm that the initial median frequency and frequency tolerance is correct, with 32 MHz median and < x PPM where "x" is the initial tolerance PPM used in the calculation to confirm total variance from 32 MHz will be less than 40 PPM.
2. Instructions for trimming the 32 MHz crystal frequency on the Apollo4 Blue SoC
- Download the Apollo4 blue example project “uart_ble_bridge” to the Apollo4 Blue.
- Send UART HCI command: 01 1E 20 03 13 25 10 to output a continuous carrier wave of 2440 MHz and measure the frequency accuracy with an appropriate RF instrument.
- Change the crystal Trim:
- The uart_ble_bridge does not yet have a vendor specific command for trimming the 32 MHz crystal, so this needs to be done by modifying the uart_ble_bridge project.
- Use am_devices_cooper_crystal_trim_set(void *pHandle, uint32_t ui32TrimValue) to set the crystal capacitance trim.
- The acceptable trim value is 10 bits, ranging from 0 to 0x3FF (default value = 0x1EC).
- Increase the trim for negative frequency offset, or decrease the trim for positive frequency offset.
- Remeasure the frequency accuracy and repeat adjusting the trim until the accuracy is within 5 PPM. Test about 20 pieces to get the average trim value to use for all boards.
- Save the calculated average trim data to a location in the Flash or INFO0. If using a single value for the project, this can be integrated in the source code.
- In application code, call “am_devices_cooper_crystal_trim_set” function at BLE Init/Bootup process in the application to set the trim value. The “am_devices_cooper_crystal_trim_set” function will set the trim value to bits 0:9 of register XTALHSTRIMS (address 0x40020128).
- The “am_devices_cooper_crystal_trim_set” function needs to be called prior to calling the am_devices_cooper_init file.
//*****************************************************************************
//
// Set the 32M crystal frequency.
// based on the tested values at customer side.
// Set trim value smaller in case of negative frequency offset.
// ui32TrimValue: default is 0x11C
// Set the 32MHz crystal frequency based on the tested values at customer side.
// Set trim value smaller in case of negative frequency offset.
//
// ui32TrimValue: default is 0x1EC.
//
// Refer to App Note "Apollo4 Blue 32MHz Crystal Calibration".
//
//*****************************************************************************
uint32_t
am_devices_cooper_crystal_trim_set(void *pHandle, uint32_t ui32TrimValue)
{
if(ui32TrimValue > 0x3FF)
{
return AM_DEVICES_COOPER_STATUS_ERROR;
}
//
// XTALHSCAP2TRIM : 6; [5..0] xtalhs_cap2_trim
// XTALHSCAPTRIM : 4; [9..6] xtalhs_cap_trim
//
g_ui32xtalhscap2trim = (ui32TrimValue & MCUCTRL_XTALHSTRIMS_XTALHSCAP2TRIM_Msk);
g_ui32xtalhscaptrim = (ui32TrimValue & MCUCTRL_XTALHSTRIMS_XTALHSCAPTRIM_Msk) >> MCUCTRL_XTALHSTRIMS_XTALHSCAPTRIM_Pos;
return AM_DEVICES_COOPER_STATUS_SUCCESS;
}
Comments
0 comments
Article is closed for comments.