This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sd_ble_gap_adv_start hangs on boot

Hi!

Program enters infinite loop in `sd_ble_gap_adv_start`.


Setup:
I've seen https://devzone.nordicsemi.com/f/nordic-q-a/11818/sd_ble_gap_adv_start-hangs-after-disconnect, doesn't help.

Using:
* SDK v14.2.0
* S132 v5.1.0
* nRF52810 QFAAB0

Following https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/the-s132-v5-1-0-is-now-production-tested-on-nrf52810,

using fix: https://devzone.nordicsemi.com/f/nordic-q-a/34784/conflicting-types-for-_putchar

There are changes in the BSP, as this is a custom board. 

Removed all NUS service stuff, added DIS service (NUS takes too much space to enable decent debugging)

Parameters going into

SVCALL(SD_BLE_GAP_ADV_START, uint32_t, sd_ble_gap_adv_start(ble_gap_adv_params_t const *p_adv_params, uint8_t conn_cfg_tag));

according to debugger:

conn_cfg_tag    = 0x01;
p_adv_params = {
    type            = 0x00 (BLE_GAP_ADV_TYPE_ADV_IND),
    p_peer_addr     = 0x00000000,
    fp              = 0x00 (BLE_GAP_ADV_FP_ANY),
    interval        = 0x0040,
    timeout         = 0x0005,
    channel_mask    = {0x00, 0x00, 0x00)
};


Problem:

On the Supervisor Call, the SD enters an infinite loop at address 0x0000B6E4 - 0x0000B6EA:

Reg state before 0x0000B6E4:
r0: 0x4000d000  -  Base address of the Random Number Generator
r1: 0x00000000

Disassembly:

0000B6E4    F8D01100    ldr.w r1, [r0, #0x100]
0000B6E8    2900        cmp r1, #0
0000B6EA    D0FB        beq 0x0000B6E4

Advertising uses the RNG for it's jitter generation. Is there something I need to do to enable the RNG? In which case, shouldn't the SD be doing it itself?

(Bloody rich text editor, what's wrong with MarkDown?)


EDIT:

@ 0xB66E the EVENTS_VALRDY is cleared.
@ 0xB674 the VALRDY interrupt is enabled.
-- branch, @ 0xB720 0x2000 is stored into 0xE000E280)  (?)
@ 0xB67E the TASKS_START is triggered. Memory view doesn't show that happening, but that's a write-only register.
@ 0xB686 0x2000 is stored into 0xe000e100 (?)
ret to 0x012CA4...

And the CONFIG register shows bias correction as ENABLED, if that matters.

Parents
  • Hi Jostikas, 

    It's pretty strange that the registers pointed to RND generator. The RND is automatically handled by the softdevice. 

    Have you tried to test the chip with S112 ? Just to make sure the hardware (with the software) working fine.
    Could you attach your project source so we can test here ? 

  • It's not that strange: These instructions ARE part of the softdevice, and it's in an infinite loop, waiting for a random number to be generated.

    I'm just setting it up to test with SD132 v5.0.0, if that doesn't work, I'll try the unmodified example (except for porting to the hardware: As I said, I don't have nRF52 DK-s handy (older version of the board had nRF51, so I got nRF51 DK-s instead :/). Will get back to you on the results.

  • TL;DR - Root cause unknown, can not reproduce.

    Okay, This is annoying.
    After having issues connencting to the board at all (even to perform a Full Erase with nRF Connect Programmer), now after playing around with supply voltages from the Power Profiler, suddenly everything just works (with either v5.0 or v5.1 S132). I mean, I get ERROR 8198 error after advertising ends, but that's probably an unhandled case on my part.

    I'd like to keep this case open at least for the next week, in case it reappears, but for now I'm blaming pixies. I messed around with the supply voltage within the 2.5 - 3.3 V range, before returning to 3V (same as previously), and that's the only thing that changed from before to now.

    FOR REFERENCE:
    My hardware setup currently is:
    * Power Profiler riding on a DK51 (PCA10028) (with SB9 cut), Power Select -> Reg (3.0 V), DUT Select -> External, COM -> DK.
    * Another DK51 (with SB9 cut) acting as debugger for the DUT. I am connecting to the DUT via 10-pin header, 4 wires connecting to DUT, the rest floating.


  • Hello Jastikas,

    I have the same problem on my nRF52 DK, the application hangs in  sd_ble_gap_adv_start. 

    Could you please tell me what exactly you changed on your setting to make it work. I measured the VDD voltage on my board, it is 2.85 V.

  • As I said, as far as I know, I changed nothing relevant. At some point, it started working, and kept working. The DUT was powered from the DK onboard regulator, and I messed about some with the voltage slider in nRF Connect Power Profiler.

Reply Children
No Data
Related