As mentioned in this other post, its important to have the correct trim on the external XTAL. However, once you have found the required trim to properly adjust the frequency, it is not very practical to manually adjust it in every device. So here is where changing the default XTAL trim comes in handy.
With the KW41 Connecitivity Software 1.0.2, it is a pretty straightforward process. In the hardware_init.c file, there is a global variable mXtalTrimDefault. To change the default XTAL trim, simply change the value of this variable. Remember it is an 8 bit register, so the maximum value would be 0xFF.
With the KW40, it is a similar process; however, it is not implemented by default on the KW40 Connectivity Software 1.0.1, so it should be implemented manually, following these steps:
/* Default XTAL trim value */
static const uint8_t mXtalTrimDefault = 0xBE;
if(0xFFFFFFFF == gHardwareParameters.xtalTrim)
{
gHardwareParameters.xtalTrim = mXtalTrimDefault;
}
/* Allows XTAL trimming */
#define gXcvrXtalTrimEnabled_d 1