DA14585/DA14586 Crystal trimming lost after sleep

ID: LPCBARESDK-706

Status: Fixed

First reported: 6.0.12.1020

Fixed in: 6.0.16.1144

Description

Trimmed DA14585/DA14586 devices will loose their XTAL16M trim value once they go to sleep. This can cause, depending on the device the DA14585/586 is operating with, degraded RF performance due to the RF frequency not being perfectly centered bluetooth channel frequency. In extreme condition, the device might operate out of the bluetooth specification tolerance.

Workaround

Make sure xtal16_calibration_check() always call set_xtal16m_trim_value(). This will ensure the crystal trimming is applied up on wake up.

In sdk/platform/arch/main/arch_system.c:

static __inline void xtal16m_calibration_check(void)
{
    uint16_t trimvalue = GetWord16(CLK_FREQ_TRIM_REG);   //Get the value stored from the booter
    #if (DEFAULT_XTAL16M_TRIM_VALUE_USED)
    // Apply the default XTAL16M trim value if a trim value has not been programmed in OTP
    if (trimvalue == 0)                    // Override the value if the device is untrimmed and DEFAULT_XTAL16M_TRIM_VALUE_USED is 1
    {
        trimvalue=DEFAULT_XTAL16M_TRIM_VALUE;
    }
    #endif
    set_xtal16m_trim_value(trimvalue);  // It is always called
}