How to modify the advertisement packet content in the radio notification callback interrupt?

你好!

我使用 NCS 2.5.0,radio_notification,无线电处理程序。

我想在每次启动天线时递增,并将 的值写入通告数据包。ii

在函数 中,调用 会导致开发板每次崩溃。radio_handlerbt_le_ext_adv_set_data

你能帮我吗?

错误信息如下:

*** Booting nRF Connect SDK v2.5.0 ***
Starting Bluetooth multiple advertising sets example
I: SoftDevice Controller build revision:
I: c5 93 ba a9 14 4d 8d 05 |.....M..
I: 30 4e 9b 92 d7 71 1e e8 |0N...q..
I: aa 02 50 3c |..P<
I: HW Platform: Nordic Semiconductor (0x0002)
I: HW Variant: nRF52x (0x0002)
I: Firmware: Standard Bluetooth controller (0x00) Version 197.47763 Build 2370639017
I: Identity: DD:78:A1:BA:18:E4 (random)
I: HCI: version 5.4 (0x0d) revision 0x1102, manufacturer 0x0059
I: LMP: version 5.4 (0x0d) subver 0x1102
Bluetooth initialized
Created adv: 0x20001b80
0
Connectable adv20 started
Created adv: 0x20001bd8
0
Connectable adv50 started
Created ASSERTION FAIL @ WEST_TOPDIR/zephyr/kernel/sem.c:128
E: r0/a1: 0x00000004 r1/a2: 0x00000080 r2/a3: 0x00000001
E: r3/a4: 0x0001f0b1 r12/ip: 0x000000ff r14/lr: 0x00022b13
E: xpsr: 0x61000025
E: Faulting instruction address (r15/pc): 0x000285b6
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
E: Fault during interrupt handling

E: Current thread: 0x20003868 (unknown)
E: Resetting system

Parents
  • Hi Allen

    I'd recommend checking out how the bt_le_ext_adv_set_data() function is set in other samples as I don't think it's generally a good idea to have it within an interrupt callback which usually is very timing sensitive. In I.E. the Distance measurement sample, the bt_le_ext_adv_set_data() function is called within the adv_start() function initially, and then within an adv_update_data() function if the advertising set data needs to be updated during runtime. Also note that "when updating the advertising data while advertising the advertising data and scan response data length must be smaller or equal to what can be fit in a single advertising packet. Otherwise the advertiser must be stopped." (from bluetooth.h in ...\zephyr\include\zephyr\bluetooth\bluetooth.h

    Best regards,

    Simon

Reply
  • Hi Allen

    I'd recommend checking out how the bt_le_ext_adv_set_data() function is set in other samples as I don't think it's generally a good idea to have it within an interrupt callback which usually is very timing sensitive. In I.E. the Distance measurement sample, the bt_le_ext_adv_set_data() function is called within the adv_start() function initially, and then within an adv_update_data() function if the advertising set data needs to be updated during runtime. Also note that "when updating the advertising data while advertising the advertising data and scan response data length must be smaller or equal to what can be fit in a single advertising packet. Otherwise the advertiser must be stopped." (from bluetooth.h in ...\zephyr\include\zephyr\bluetooth\bluetooth.h

    Best regards,

    Simon

Children
No Data
Related