nRF52832 BLE Works Once, Then Fails – Stuck in HFCLK Initialization

Hi everyone!

I'm having trouble getting a custom PCB with the nRF52832 chip to work, specifically with enabling BLE functionality.

It seems there are issues related to the HFCLK (High-Frequency Clock). I tried running a sample test code I found in the forums, but it gets stuck in the following while loop:

NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_32Bit << TIMER_BITMODE_BITMODE_Pos;
NRF_TIMER1->TASKS_CLEAR = 1;
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_TIMER1->TASKS_START = 1;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
NRF_TIMER1->TASKS_CAPTURE[0] = 1;

After several weeks of troubleshooting, I soldered a new board, and the first time I flashed it, the BLE application ran perfectly. However, on the second boot, it stopped working, and if I run the above code again, it still gets stuck at the same spot.

The hardware design follows the recommended guidelines from the documentation. The rest of the program seems to run fine, and the power supply current has never exceeded 14mA at 3V.

Does anyone have any ideas on what could be causing these issues or where I should investigate further?

Thanks for your help!

P.S.: By the way, when I attempt to log via RTT, I get this error:

00> [00:00:01.618,621] <err> os: ***** HARD FAULT *****
00> [00:00:01.618,621] <err> os:   Debug event
00> [00:00:01.618,652] <err> os: r0/a1:  0xfffffff5  r1/a2:  0xe000ed00  r2/a3:  0x20003844
00> [00:00:01.618,652] <err> os: r3/a4:  0x00000001 r12/ip:  0x00000004 r14/lr:  0x00027ae1
00> [00:00:01.618,682] <err> os:  xpsr:  0x61000000
00> [00:00:01.618,682] <err> os: Faulting instruction address (r15/pc): 0x00011000
00> [00:00:01.618,743] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
00> [00:00:01.618,774] <err> os: Current thread: 0x20002be0 (unknown)
00> [00:00:02.485,076] <err> os: Halting system

Any idea what might be causing this? I also saw the same error when it ran successfully.

Parents
  • Hi

    This all sounds incredibly strange. The Zephyr stack is not experimental btw, and both should work fine Both with and without bonding. Let me know how the HW review case goes, as I'm hesitant to dive any deeper before confirming whether this is a HW issue or not.

    You could upload the board file you're using in NCS for your custom board, so we could have a look at that as well.

    Best regards,

    Simon

  • Hi Simonr,

    Hardware Revision: (Case ID: 336239)

    I have tested with new Ccap values and soldered a new board, but the issue seems to persist. Some issues have arisen during the revision, but they are related to the RF line of the antenna. However, under very specific conditions, the device has been connectable.

    I am testing two board configurations:

    1. A custom board built from scratch, which doesn’t work very well.
    2. The nRF52DK_nRF52832 board, with LEDs and button options disabled, as well as some other configurations like disabling the DCDC.

    Recap:

    The standard examples to run Bluetooth don’t work. I used the following code to check the HFCLK startup time, but it gets stuck in the loop:

    NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_32Bit << TIMER_BITMODE_BITMODE_Pos;
    NRF_TIMER1->TASKS_CLEAR = 1;
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_TIMER1->TASKS_START = 1;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    NRF_TIMER1->TASKS_CAPTURE[0] = 1;


    When running the default SoftDevice Bluetooth stack, the following error occurs after starting advertising:
    00> [00:00:01.618,621] <err> os: ***** HARD FAULT *****
    00> [00:00:01.618,621] <err> os:   Debug event
    00> [00:00:01.618,652] <err> os: r0/a1:  0xfffffff5  r1/a2:  0xe000ed00  r2/a3:  0x20003844
    00> [00:00:01.618,652] <err> os: r3/a4:  0x00000001 r12/ip:  0x00000004 r14/lr:  0x00027ae1
    00> [00:00:01.618,682] <err> os:  xpsr:  0x61000000
    00> [00:00:01.618,682] <err> os: Faulting instruction address (r15/pc): 0x00011000
    00> [00:00:01.618,743] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    00> [00:00:01.618,774] <err> os: Current thread: 0x20002be0 (unknown)
    00> [00:00:02.485,076] <err> os: Halting system
    

    I disabled the log and printk modules in case they were interfering with Bluetooth functionality, but it made no difference.

    I enabled the option CONFIG_BT_LL_SW_SPLIT=y to use the Zephyr stack.

    If I run the HFCLK detection code, it still gets stuck in the loop.

    If I run the program without that check, the device starts advertising and becomes connectable. The functionality is a bit unstable—sometimes it only works while debugging, other times only when not debugging. Occasionally, it disconnects quickly. However, I have managed to establish a connection in some instances.

    Thank you for all your help!

Reply
  • Hi Simonr,

    Hardware Revision: (Case ID: 336239)

    I have tested with new Ccap values and soldered a new board, but the issue seems to persist. Some issues have arisen during the revision, but they are related to the RF line of the antenna. However, under very specific conditions, the device has been connectable.

    I am testing two board configurations:

    1. A custom board built from scratch, which doesn’t work very well.
    2. The nRF52DK_nRF52832 board, with LEDs and button options disabled, as well as some other configurations like disabling the DCDC.

    Recap:

    The standard examples to run Bluetooth don’t work. I used the following code to check the HFCLK startup time, but it gets stuck in the loop:

    NRF_TIMER1->BITMODE = TIMER_BITMODE_BITMODE_32Bit << TIMER_BITMODE_BITMODE_Pos;
    NRF_TIMER1->TASKS_CLEAR = 1;
    NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
    NRF_TIMER1->TASKS_START = 1;
    NRF_CLOCK->TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
    NRF_TIMER1->TASKS_CAPTURE[0] = 1;


    When running the default SoftDevice Bluetooth stack, the following error occurs after starting advertising:
    00> [00:00:01.618,621] <err> os: ***** HARD FAULT *****
    00> [00:00:01.618,621] <err> os:   Debug event
    00> [00:00:01.618,652] <err> os: r0/a1:  0xfffffff5  r1/a2:  0xe000ed00  r2/a3:  0x20003844
    00> [00:00:01.618,652] <err> os: r3/a4:  0x00000001 r12/ip:  0x00000004 r14/lr:  0x00027ae1
    00> [00:00:01.618,682] <err> os:  xpsr:  0x61000000
    00> [00:00:01.618,682] <err> os: Faulting instruction address (r15/pc): 0x00011000
    00> [00:00:01.618,743] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
    00> [00:00:01.618,774] <err> os: Current thread: 0x20002be0 (unknown)
    00> [00:00:02.485,076] <err> os: Halting system
    

    I disabled the log and printk modules in case they were interfering with Bluetooth functionality, but it made no difference.

    I enabled the option CONFIG_BT_LL_SW_SPLIT=y to use the Zephyr stack.

    If I run the HFCLK detection code, it still gets stuck in the loop.

    If I run the program without that check, the device starts advertising and becomes connectable. The functionality is a bit unstable—sometimes it only works while debugging, other times only when not debugging. Occasionally, it disconnects quickly. However, I have managed to establish a connection in some instances.

    Thank you for all your help!

Children
No Data
Related