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

    I tried translating your initial question, and from that it seems like you say the DK crashes every time. Is that correct, or does it only crash sometimes? From the log you uploaded it seems like there is an assertion in the Zephyr kernel semaphores file, so I'm guessing this increment you've added is maybe causing timing issues with the other advertising sets in your application. Does the application work as expected if you remove this increment counter from your radio handler I think it would in general be better to add it after a radio event is completed instead of in the middle of it, since the radio peripheral is very timing critical. Seemingly it is causing some issues with the interrupt handing in your application.

    Best regards,

    Simon

Reply
  • Hi

    I tried translating your initial question, and from that it seems like you say the DK crashes every time. Is that correct, or does it only crash sometimes? From the log you uploaded it seems like there is an assertion in the Zephyr kernel semaphores file, so I'm guessing this increment you've added is maybe causing timing issues with the other advertising sets in your application. Does the application work as expected if you remove this increment counter from your radio handler I think it would in general be better to add it after a radio event is completed instead of in the middle of it, since the radio peripheral is very timing critical. Seemingly it is causing some issues with the interrupt handing in your application.

    Best regards,

    Simon

Children
  • Hello, thank you very much for your patient explanation.

    The issue causing the DK to crash is not the variables I mentioned, but rather the bt_le_ext_adv_set_data function.This code runs well after commenting out the bt_le_ext_adv_set_data function, but uncommenting it causes the DK to crash.

    What I want to know is whether it is possible to call bt_le_ext_adv_set_data in the interrupt callback function radio_handler to update the broadcast packet data. If it's not feasible, how should I update the broadcast packet data within radio_handler?

    By the way, could you tell me if there’s a problem with my interrupt setup? My interrupt setup is as follows:

    Best regards,

    allen

Related