Hi,
I am trying to measure the distance of two objects, which can vary from 20 to 350 meters. We have tried the nRF Distance Measurement with Bluetooth LE discovery, which worked fine up to 120 meters. I would like to increase the range by increasing the transmit power to 8 or at least 4 dBm.
I took this code snippet we found here and added it to the RF Distance Measurement with Bluetooth LE discovery. This is what I added to the code:
err = service_ddfs_init(); if (err) { printk("DDF Service init failed (err %d)\n", err); return 0; } set_tx_power(BT_HCI_VS_LL_HANDLE_TYPE_ADV,0, 4); err = bt_enable(NULL); if (err) { printk("Bluetooth init failed (err %d)\n", err); return 0; }
After running the code I got an exception fromt hci core:
*** Booting Zephyr OS build v3.3.99-ncs1 *** Starting Distance Measurement example E: ***** MPU FAULT ***** E: Data Access Violation E: MMFAR Address: 0x14d31 E: r0/a1: 0x00000000 r1/a2: 0x00000004 r2/a3: 0x00014d31 E: r3/a4: 0x2000f700 r12/ip: 0x00000022 r14/lr: 0x00032e59 E: xpsr: 0x21000000 E: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000 E: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000 E: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000 E: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000 E: fpscr: 0x00000000 E: Faulting instruction address (r15/pc): 0x0003c76a E: >>> ZEPHYR FATAL ERROR 19: Unknown error on CPU 0 E: Current thread: 0x20007698 (unknown) E: Resetting system
After looking in the zehpyhr.lst file to see where the program counter was before the exception occurred, I couldn't find anything helpful:
0003c75e <z_handle_obj_poll_events>: { 3c75e: 4603 mov r3, r0 return list->head == list; 3c760: 6800 ldr r0, [r0, #0] if (!sys_dlist_is_empty(list)) { 3c762: 4283 cmp r3, r0 3c764: d008 beq.n 3c778 <z_handle_obj_poll_events+0x1a> sys_dnode_t *const next = node->next; 3c766: e9d0 3200 ldrd r3, r2, [r0] prev->next = next; 3c76a: 6013 str r3, [r2, #0] next->prev = prev; 3c76c: 605a str r2, [r3, #4] node->next = NULL; 3c76e: 2300 movs r3, #0 node->prev = NULL; 3c770: e9c0 3300 strd r3, r3, [r0] (void) signal_poll_event(poll_event, state); 3c774: f7ff bf99 b.w 3c6aa <signal_poll_event> } 3c778: 4770 bx lr
I also tried to change the TX power with configuration flag defined in the prj.conf, but It did not improve or help anything:
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
Can someone explaine me what is happening?
Thanks for the help!!!
OS: Windows
SDK: 2.4.0
IDE: Visual Studio Code
Hardware: nRF52840 DK