On-board C program for Anchor


I am wondering if there’s an example program for anchor configuring? particularly for the onboard C program.

I am trying to set up a network with 3 anchors and 1 tag. I have that 1 tag connected with raspberry pi through UART, running the tag example code from onboard package/host_api/tag_cfg. But I don’t know which program I should flash onto the anchors so I can get X_Y_Z readings out of that tag_cfg program.

Thanks in advance!

Hi there,

perhaps it would help if you could describe your intention with the C program in anchor mode.

Please note, that the anchor do not provide the same location functionality as the Tags, i.e. it does not measure and calculate its position with other surrounding anchors. It functions as a stationary infrastructure node providing reference position and location service for the mobile nodes.


im trying to get the Anchor C code (or example) also, because i want to sent IoT data when a “X” condition happend, how can i get it ?

I also think that i can use the dwm-simple.c code and change the configuration (the example as default is a tag) to anchor, how can i do it ?


In the R1 i have the posibilities to do it in :

/* Get node configuration */ 

  if ((cfg.mode != DWM_MODE_TAG) ||
	(cfg.accel_en != false) ||
	(cfg.loc_engine_en != true) ||
	(cfg.meas_mode != DWM_MEAS_MODE_TWR) ||
	(cfg.low_power_en != false) ||
	(cfg.common.fw_update_en != false) ||
	(cfg.common.uwb_mode != DWM_UWB_MODE_ACTIVE) ||
	(cfg.common.ble_en != true) ||
	(cfg.common.led_en != true)) {

	/* Configure device as TAG */
	cfg_tag.accel_en = false;
	cfg_tag.loc_engine_en = true;
	cfg_tag.low_power_en = false;
	cfg_tag.meas_mode = DWM_MEAS_MODE_TWR;
	cfg_tag.common.fw_update_en = false;
	cfg_tag.common.uwb_mode = DWM_UWB_MODE_ACTIVE;
	cfg_tag.common.ble_en = true;
	cfg_tag.common.led_en = true;


When i do a function to do it as :

void Inicializar(void)
dwm_cfg_anchor_t cfg;
int rv;
cfg.initiator = 1;
cfg.bridge = 0;
cfg.common.enc_en = 0;
cfg.common.led_en = 1;
cfg.common.ble_en = 1;
cfg.common.fw_update_en = 0;
cfg.common.uwb_mode = 2;
rv = dwm_cfg_anchor_set(&cfg);
if (rv == DWM_ERR_PERM)
printf(“Error: either encryption or BLE can be enabled, encryption can be enabled only if encryption key is set\n”);

I got a crazy switching of the LEDS (all on, all off so fast)

im calling the function in the "void app_thread_entry(uint32_t data) ", first thing to do.

Hi Franco,

LEDs blinking in the loop means the module keeps reseting.
Can you please share the whole file? From the first sight I do not see any issue in this code.


hi, i could solve it commenting the dwm_reset(); function. !


Ok :slight_smile: