DW3000 API call problem

Hello, I am using PCA10040 with nRF52832 SOC. On top of it, I installed pcl298336 shield board with DWM3000 module, that contains DW3110 chip.

I am using DW3XXX_API_rev9p3. I ported the example project (that was originally intended for nRF52840) to nRF52832, with the use of legacy nRF5 SDK 17.1.0_ddde560. The project is built and ran using SEGGER Embedded Studio v8.16b.

The project is liked with libdwt_uwb_driver-m4-hfp-6.0.7.a library.

I ran the project and it works fine, right until the precompiled library’s function “dwt_readdevid()” is called. I use non-modified ex_00a_reading_dev_id example.

The disassembly of readdevid() with runtime values are here:
<dwt_readdevid>
B510 push {r4, lr}
B082 sub sp, sp, #8
2100 movs r1, #0
AB02 add r3, sp, #8 ; after exec: r3 = 0x2000ffe0, sp = 0x2000ffd8
F8431D04 str r1, [r3, #-4]! ; after exec: r1 = 0x00000000, r3 = 0x2000ffdc
4A04 ldr r2, =0x20000C5C ; after exec: r2 = 0x20000c5c
6810 ldr r0, [r2]; after exec: r0 = 0x20000c60
6882 ldr r2, [r0, #8]; after exec: r2 = 0x00000000
6912 ldr r2, [r2, #16]; after exec: r2 = 0x00012015
6AD4 ldr r4, [r2, #0x2C]; after exec: r4 = 0xbf600101
460A mov r2, r1; after exec: r2 = 0x00000000
47A0 blx r4 ; EXCEPTION TRIGGERED
9801 ldr r0, [sp, #4]
B002 add sp, sp, #8
BD10 pop {r4, pc}
20000C5C .word 0x20000C5C

The instruction ‘BLX r4’ trips the processor, as the value inside R4 is invalid for branching. The problem is probably because the library loads static address 0x20000C5C into R2 and then accesses some subfields from that address. It should be probably a conf. data structure inside ram or something.

0x20000000 is the beginning of RAM region, but the data fetched by qorvo library is obviously not what should be fetched. Did I compile or layed the library wrongly in the memory? Or should I check if the library is initialized properly before calling this function? (the example project should do it though).

Thank you for any help.

Hi @Patross2 ,

In ex_00a_reading_dev_id example, can you check whether this pointer dw3000_probe_interf.dw->dwt_driver is NULL or not ? If it is NULL, it means that there is something wrong with your porting because it cannot find the correct driver for uwb chip.

Best Regards,
TN

Hello, thanks for the response.
I identified this exact problem that you describe. I switched to DW3_QM33_SDK and I have the source code of the library now. Indeed. dwt%driver structure is NULL. Don’t know why, because I did hardly any changes to the source code. Just changed SPI driver number and board definition file.

Hi @Patross2 ,

I think that you need to check SPI bus communication and UWB reset sequence. That dwt_driver is NULL because UWB ID is invalid and dwt_probe could not find a driver matching with the UWB ID. Hope that helps.

Best Regard,
TN