While working with the FRDM-KW41Z board, I noticed the following bugs / issues / curiosities with the XCVR driver code. All files are part of the folder middleware/wireless/framework_5.3.4/XCVR. MCUXpresso SDK was built as follows:
Build Date: 2018-02-21, Board: FRDM-KW41Z
OS: Mac, Toolchain: All Toolchains
Components: 802.15.4 MAC
SDK Version: KSDK 2.2.0 (2018-01-19)
- In fsl_xcvr_common_config.c, lines 478-479, the same member is initialised twice.
.recycle_count_init_26mhz = B3(0) | B2(0x1C + ADD_FOR_26MHZ) | B1(0x06) | B0(0x66 + ADD_FOR_26MHZ),
.recycle_count_init_26mhz = B3(0) | B2(0x1C) | B1(0x06) | B0(0x66),
I suspect this is a copy/paste error, but can not be sure nothing else is amiss. If we just look at the structure declaration, it seems that these lines should be:
.recycle_count_init_26mhz = B3(0) | B2(0x1C + ADD_FOR_26MHZ) | B1(0x06) | B0(0x66 + ADD_FOR_26MHZ),
.recycle_count_init_32mhz = B3(0) | B2(0x1C) | B1(0x06) | B0(0x66),
- In fsl_xcvr_trim.c, function void DC_Measure_short(IQ_t chan, DAC_SWEEP_STEP2_t dcoc_init_val) (lines 289-325), there seems to be some unused debug code.
The loop is hardcoded to run only once ("iterations = 1") and the sum_ variables are only used as shown in the snippet below.
int8_t i;
const int8_t iterations = 1;
sum_dc_meas_i = 0;
sum_dc_meas_q = 0;
for (i = 0; i < iterations; i++) {
rx_dc_sample_average(&dc_meas_i, &dc_meas_q);
sum_dc_meas_i = sum_dc_meas_i + dc_meas_i;
sum_dc_meas_q = sum_dc_meas_q + dc_meas_q;
}
sum_dc_meas_i = sum_dc_meas_i / iterations;
sum_dc_meas_q = sum_dc_meas_q / iterations;
- In fsl_xcvr_gfsk_bt_0p3_h_0p5_config.c, lines 157-165:
#if RADIO_IS_GEN_2P0
XCVR_RX_DIG_AGC_CTRL_2_TZA_PDET_SEL_HI(7) |
XCVR_RX_DIG_AGC_CTRL_2_AGC_FAST_EXPIRE(5),
#else
XCVR_RX_DIG_AGC_CTRL_2_TZA_PDET_SEL_HI(5) |
XCVR_RX_DIG_AGC_CTRL_2_AGC_FAST_EXPIRE(16),
#endif
XCVR_RX_DIG_AGC_CTRL_2_AGC_FAST_EXPIRE(5),
.agc_ctrl_2_init_32mhz = XCVR_RX_DIG_AGC_CTRL_2_BBA_GAIN_SETTLE_TIME(12) |
The penultimate line in the snippet above causes the field .agc_ctrl_2_init_32mhz to be initialised twice. I suspect this is a copy/paste error and that the line should be removed. - In fsl_xcvr_gfsk_bt_0p7_h_0p5_config.c, lines 80-86:
/* XCVR_RX_DIG configs */
.rx_dig_ctrl_init_26mhz = XCVR_RX_DIG_RX_DIG_CTRL_RX_FSK_ZB_SEL(0) | /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_DC_RESID_EN(1), /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_SRC_RATE(0),
.rx_dig_ctrl_init_32mhz = XCVR_RX_DIG_RX_DIG_CTRL_RX_FSK_ZB_SEL(0) | /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_DC_RESID_EN(1), /* Depends on protocol */
The line containing XCVR_RX_DIG_RX_DIG_CTRL_RX_SRC_RATE(0), causes the field .rx_dig_ctrl_init_32mhz to be initialised twice. I am not sure what the original intent was of the code here, but when cross-referencing other configuration files, it seems that actually the line above, XCVR_RX_DIG_RX_DIG_CTRL_RX_DC_RESID_EN(1), /* Depends on protocol */, erroneously ends in a comma and should have been OR-ed instead:
/* XCVR_RX_DIG configs */
.rx_dig_ctrl_init_26mhz = XCVR_RX_DIG_RX_DIG_CTRL_RX_FSK_ZB_SEL(0) | /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_DC_RESID_EN(1) | /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_SRC_RATE(0),
.rx_dig_ctrl_init_32mhz = XCVR_RX_DIG_RX_DIG_CTRL_RX_FSK_ZB_SEL(0) | /* Depends on protocol */
XCVR_RX_DIG_RX_DIG_CTRL_RX_DC_RESID_EN(1), /* Depends on protocol */