Setup of the SES for MDEK1001

Hi, I am a newbie to the DecaWave. Currently, I have a project using MDEK1001 and I need to read the Accumulator data, (i.e., CIR data) from the MDEK1001.

But first, I would like to ask some questions about the setup of the SES. I want to try the examples from GitHub as a start. So I download the SES and installed the related packages. I connected the MDEK1001 to the computer via USB. Then, I clicked “Connect J-Link” from the “Target” Mecu. After it showed After the SES showed “CortexM4 on J-Link” on the bottom, I clicked “Build and Run”. However, I did not know if the code is loaded to the MCU. In the SES, I didn’t see any results displayed.
For example, I saw the code:

printf(“Singled Sided Two Way Ranging Initiator Example \r\n”);

But in the Output, I couldn’t find the above words appears. It only showed:

Connecting ‘J-Link’ using ‘USB’
Connecting to target using SWD
Loaded C:/Program Files/SEGGER/SEGGER Embedded Studio for ARM 3.40/bin/JLink_x64.dll
Firmware Version: J-Link OB-STM32F072-128KB-CortexM compiled May 4 2017 14:43:23
DLL Version: 6.32c
Hardware Version: V1.00
Target Voltage: 3.300
Device “NRF52832_XXAA” selected.
Found SW-DP with ID 0x2BA01477
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Preparing target for download
Executing script TargetInterface.resetAndStop()
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.
Downloading ‘ss_twr_init.elf’ to J-Link
Programming 32.1 KB of addresses 00000000 — 00008077
Programming 0.0 KB of addresses 00008078 — 000080b7
J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
Download successful

May I know how I can get the results such as distance showing in the Output?

Thanks and regards,
Chang

Hi Chang,

In the TWR examples, the printf function is redirected to the UART.

So what you need to do is to setup a serial connection using a tool such as TeraTerm, with the configuration 115200-8bits-none-1.

The TWR examples calculates distance between two devices. The first device is an initator and the second is a responder. You will need to flash two dwm1001.

Regarding your accumulator question, you may have to make a fully custom code using the dw1000 api. There is a dwt_readaccdata api function that will allow you to read the accumulator.

You will find full documentation in the package below.

https://www.decawave.com/sites/default/files/dw1000_api_rev2p04-1.zip

Let me know how it goes,
Regards
Yves

Hi Yves,

Thanks for your reply. Now I have seen the counter, distance, etc. from the UART. I will try the other examples first and then check out how to read the accumulator data.

Thanks a lot,
Chang

Dear Yves,

I have some further questions regarding the example. I am using the SES to run ss_twr_init. I can see the result from UART. However, there are some places in the code I cannot understand.

  1. In the main() function, I can see the code runs to vTaskStartScheduler();, instead of

while (1)
{
ss_init_run();
}

While in the function vTaskStartScheduler(), I cannot find any code to call the ss_init_run(). I know ss_init_run() is called. But I don’t know from where.

  1. Since you provided me the DW1000 API and examples, does it mean that I can modify the code from Example 6.3.7, i.e., Simple RX with diagnostics example code, to MDEK1001?

  2. A quick question about printf(). I noticed that dwt_readdevid() returns uint32. I want to display it to the UART, but it always fails. Is it right to use:

printf(“ID: %u \n”,dwt_readdevid());

Thanks,
Chang

===================================
Hi Chang,

  1. The program is using the freeRTOS, so the program will run the ss_init_run() in the freeRTOS API. This can be set on the sdk_config.h. Just comment out the marco “#define USE_FREERTOS”. Then the program will run as you expect. For the freeRTOS concept, you can baidu it. Many information about this.

2.Not familiar with DW1000…
3.We need more information. What do you mean always fail? Compile fail? Or the value display not correct?maybe google it or baidu can find the answer.

Regards,
mhc

[size=medium]Hi Chang,[/size]

[color=#333333][size=medium]Since you provided me the DW1000 API and examples, does it mean that I can modify the code from Example 6.3.7, i.e., Simple RX with diagnostics example code, to MDEK1001? [/size][/color]

[color=#333333][size=medium]Yes you can adapt the example 6.3.7 to run on the DWM1001 but be careful. This example was initially meant to run on stm32 mcu and the DWM1001 uses nordic nrf52832, so you will have to do a porting exercise.[/size][/color]

[color=#333333][size=medium]Thank you,[/size][/color]
[color=#333333][size=medium]Regards[/size][/color]
[color=#333333][size=medium]Yves [/size][/color]

Thanks mhc,

I will search freeRTOS for more information. Thank you for your explanation.

I wrote printf(“ID: %u \n”,dwt_readdevid()); after the example code

printf(“Singled Sided Two Way Ranging Initiator Example \r\n”);

It can be compiled and the code can run. However, in the UART, I can only see:

Singled Sided Two Way Ranging Initiator Example

and it is stuck there. No Transmission #. Nothing. When I used debug mode, I found that the arrow just got stuck at the line:

printf(“ID: %u \n”,dwt_readdevid());

Please advise.

Thanks and regards,
Chang