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)
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_26mhz = B3(0) | B2(0x1C) | B1(0x06) | B0(0x66),
.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),
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;
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.#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 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 */
/* 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 */