Hi. I download Qorvo Nearby Interaction as below to test.
I open nRF52840DK-QANI-FreeRTOS.emProject with segger embeded stuidio in this directory:
Qorvo_Nearby_Interaction_3_2_1\Software\Accessory\Sources\QANI-All-FreeRTOS_QNI_3_0_0\QANI-All-FreeRTOS_QNI_3_0_0\Projects\Projects\QANI\FreeRTOS\nRF52840DK\ses
I build and flash the firmware into nRF52840-DK which has a shield with DWM3000 on it, and then use iphone 14 pro max Qorvo NI app to test. The test results are normal, ble can be connected, distances can be measured.
Then, I download the same firmware into my own board (nRF52840+dw3120). The difference between my own board and nRF52840-DK is that my own board’s uwb chip is dw3120, while nRF52840-DK’s shield’s uwb chip is dw3110.
Phenomenon on my own board is that ble can be connected, but distance measuring always report err:
app: {“Block”:10, “results”:[{“Addr”:“0x802b”,“Status”:“Err”}]}
(The error code is 5).
So, I guess the problem may be caused by changing dw3110 to dw3120 and dw3120 need some configuration different.
According to Qorvo Nearby Interaction Accessory Developer Guide, maybe I need to edit src/Boards/src/nRF52840DK/rf_tuning_config.c,the code of this file is as below:
#include <string.h>
#include "rf_tuning_config.h"
#include "deca_device_api.h"
#include "default_config.h"
#define DEFAULT_ANTD (513.484f * 1e-9 / DWT_TIME_UNITS) /*Total antenna delay*/
#define DEFAULT_PDOAOFF 0 /**< Phase Differences offset */
#define DEFAULT_RNGOFF 0 /**< Ranging offset */
#define DEFAULT_ANTENNA_TYPE ANT_TYPE_JOLIE9
#define DEFAULT_TX_POWER_REGULAR_PULSE_AOA 0xa6a6a6a6UL
#define DEFAULT_TX_POWER_REGULAR_PULSE_NON_AOA 0x8a8a8a8aUL
#define DEFAULT_TX_POWER_ALTERNATE_PULSE_AOA 0x93939393UL
#define DEFAULT_TX_POWER_ALTERNATE_PULSE_NON_AOA 0x63636363UL
static const rf_tuning_t rf_tuning_config_flash_default =
{
.txConfig.PGdly = 0x34,
.txConfig.power = DEFAULT_TX_POWER_REGULAR_PULSE_AOA,
.txConfig.PGcount = 0,
.pdoaOffset_deg = DEFAULT_PDOAOFF,
.rngOffset_mm = DEFAULT_RNGOFF,
.antRx_a = (uint16_t)(0.5 * DEFAULT_ANTD),
.antTx_a = (uint16_t)(0.5 * DEFAULT_ANTD),
.antRx_b = (uint16_t)(0.5 * DEFAULT_ANTD),
.antenna = { DEFAULT_ANTENNA_TYPE, DEFAULT_ANTENNA_TYPE,
ANT_TYPE_NONE, ANT_TYPE_NONE },
.xtalTrim = (DEFAULT_XTAL_TRIM),
.paverage = 10,
//QM35725 specific
.tx_ant = 1, //select ANT1 as TX
.rxa_ant = 3, //select ANT3 as RX, PATH A
.rxb_ant = 2, //select ANT2 as, RX PATH B
.lna1 = 0, //BYPASS
.lna2 = 0, //BYPASS
.pa = 0 //LOW PA
};
static rf_tuning_t rf_tuning_config_ram __attribute__((section(".rconfig"))) = {0};
rf_tuning_t *get_rf_tuning_config(void) {
return &rf_tuning_config_ram;
}
dwt_txconfig_t *get_dwt_txconfig(void) {
return &rf_tuning_config_ram.txConfig;
}
void rf_tuning_set_tx_power_pg_delay(uint32_t dev_id)
{
switch (dev_id)
{
case DWT_DW3000_PDOA_DEV_ID:
rf_tuning_config_ram.txConfig.power = DEFAULT_TX_POWER_REGULAR_PULSE_AOA;
rf_tuning_config_ram.txConfig.PGdly = 0x34;
break;
case DWT_DW3000_DEV_ID:
rf_tuning_config_ram.txConfig.power = DEFAULT_TX_POWER_REGULAR_PULSE_NON_AOA;
rf_tuning_config_ram.txConfig.PGdly = 0x34;
break;
case DWT_QM33120_PDOA_DEV_ID:
rf_tuning_config_ram.txConfig.power = DEFAULT_TX_POWER_ALTERNATE_PULSE_AOA;
rf_tuning_config_ram.txConfig.PGdly = 0x27;
break;
case DWT_QM33110_DEV_ID:
rf_tuning_config_ram.txConfig.power = DEFAULT_TX_POWER_ALTERNATE_PULSE_NON_AOA;
rf_tuning_config_ram.txConfig.PGdly = 0x27;
break;
default:
break;
}
}
static void restore_rf_tuning_default_config(void)
{
/* Restore previous value of PG_delay */
uint8_t pg_delay = rf_tuning_config_ram.txConfig.PGdly;
uint32_t tx_power = rf_tuning_config_ram.txConfig.power;
memcpy(&rf_tuning_config_ram, &rf_tuning_config_flash_default, sizeof(rf_tuning_config_ram));
rf_tuning_config_ram.txConfig.PGdly = pg_delay;
rf_tuning_config_ram.txConfig.power = tx_power;
}
__attribute__((section(".config_entry"))) const void (*p_restore_rf_tuning_default_config)(void) = (const void *)&restore_rf_tuning_default_config;
I have a few questions about this code.
(1)Do I need to change this file because changing dw3110 to dw3120? If so, what should I change?
(2)Do I need to change other files because changing dw3110 to dw3120, what should I change?
(3)There is an LNA on my own board, in this code there is lna1 and lna2, how to config?
(4)In this code, there is a comment “QM35725 specific”,does this mean the code is not suitable for dw3120? but suitable for dw3110? This is somewhat confusing.
To sum up, the QNI routine can run normally on nRF52840-DK, but it keeps reporting errors when measuring distance on my own board. The UWB chip on my own board is dw3120, not dw3110 on nRF52840-DK’s shield.
Please help me to solve this problem. Thank you very much.
