Anchor to Anchor Ranging

I need your help
I activated in the source code the function to calculate the distance between the anchors. Everything works fine, but when I use a USB port analyzer to watch the frames that I received while working with anchor 0, I have the ‘ma’ and ‘mc’ frames, but when I look on anchor 1 or anchor 2, I do not have the ‘ma’.
I look at the source code but I do not understand why I dosnt have the distance between anchors on A1 and A2

Do-it’s because I did not receive the final A0?
Or is it that A0 just do not returns the calculated distances to other anchors?

Only A0 returns the distances between anchors.


see instance.c:

if((inst->gatewayAnchor)&&(currentRangeNum == inst->rangeNumAnc)) //these are the previous ranges…

inst->newRange = instance_calcranges(&inst->tofArrayAnc[0], MAX_ANCHOR_LIST_SIZE, TOF_REPORT_A2A, &inst->rxResponseMaskAnc);


how can I do so that all anchors sending ‘ma’ on USB ?

sorry, you’ll have to change the code yourself… please study how it works and adapt it to your use case,


Can you share how you enabled anchor-anchor ranging?

Anchor to anchor ranging is part of TREK source code, it is automatically enabled.


Hey tretolouis,

did you found the way how to send the data over USB in simple_rx code? can you help me?

Hi Nicola,

am just having similar issue. I wanna analyze some antenna-perfomances and wanna log the temperatur as well.
I think I know how to send the code to the PC but how can I read it there? I never had to communicate between MC and PCwith USB till now.
All help appreciated.

i Igor,

Could be that this will help you

void push_over_usb(uint8 *string, int len)

Or somewhere in the list should be mail exchange about USB work, but here are the major stuff (i have just copy the explanation):

Sorry for the late response. So I figured some things out about the USB.

Firstly send_usb_message doesn’t actually send anything. You need to do usb_run for the message to actually be transmitted. I made the push_over_usb function at the bottom of my main code that is in the attachment to combine these functions.

Secondly the libraries used for the decaranging and the example projects are different and not necessarily compatible. To get this to work I used the following procedure:

1)Start with a working ARMPC decaranging project and replace the main.c with the main.c you want to run

  1. add lcd and sleep files to platform from the example code libraries. Then import them to the workspace

  2. replace the deca_regs file with the deca_regs from the libraries from the example code

  3. remove double definition of lcd

  4. replace port files with the port from the libraries from the example code

  5. remove process_usb in deca_usb

Do these step by step and attempt to compile each time to make sure you are on the right track.

Hope this will help you