Bluetooth code not working with LF-clock = RC-oscillator.

Getting even the simplest Bluetooth samples to work on our custom boards seem to be difficult. 

The 'Beacon' sample has no dependencies on buttons or LEDs - 

and in *theory SHOULD* work if I set target=nrf52840dk (in VScode's NRFConnect plugin, build-dialogue).

 The *only* difference is that our custom board has *no 32kHz XTAL*, so we instead use internal RC-osc.

Thus, I set these symbols in "prj.conf" (but nothing else from the sample's original config):

<<

CONFIG_CLOCK_CONTROL=y
CONFIG_CLOCK_CONTROL_NRF=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n

>>

However, this ends up in a hardfault - triggered from 'mpsl_init' it seems.

But strangely, this happens *AFTER* this code is taken (at least I can step over it):

<<

err = bt_enable(bt_ready);

>>

err = 0 after line taken.

But, as soon as I let the debugger continue (there is just a 'return 0' afterwards, so only kernel-threads running)

the CPU hangs at 'k_sys_fatal_error_handler()'.

Is this a configuration-related problem? If yes, what other symbols must be set/unset?? Is using internal RC-osc for LCclock NOT recommended at all when using BT/BLE???

Nordic documentation is vague or non-existent when it comes to 32kHz RC-osc usage restrictions.

NOTE;: I have tried to set these symbols as well - but to no avail:

<<

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_LF_ALWAYS_ON=y
CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_PERIOD=8000

>>

Parents
  • Hi,

    The LFRC does not have any external depencies, and should always work, so I do not see it as likely that this is what causes the issue (but if you have not configured the LFCR, execution would stop earlier waiting forever for the non-existing crystal oscillator to start, without triggering an error).

    You write that you use the beacon sample. Have you done any modifications to it? For instance started using peripherals that are used by the kernal or SoftDevice controller?

    Have you enabled and checked the UART log? If so, you should see an indicated of what type of error ocured there.

  • As stated: *no modifications* - except exactly the 5 lines shown in my request. Have tried with and without the 3 extra lines (rgd. calibration) with no luck. Trace from RTT-terminal:

    <<

    00:00:00.002,593] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 54.58864 Build 1214809870
    [00:00:00.003,509] <inf> bt_hci_core: Identity: CE:0B:6F:A3:CD:64 (random)
    [00:00:00.003,540] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x118f, manufacturer 0x0059
    [00:00:00.003,570] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x118f
    Bluetooth initialized
    Beacon started, advertising as CE:0B:6F:A3:CD:64 (random)
    [00:00:00.006,866] <err> mpsl_init: MPSL ASSERT: 112, 1706
    [00:00:00.006,866] <err> os: ***** HARD FAULT *****
    [00:00:00.006,866] <err> os: Fault escalation (see below)
    [00:00:00.006,896] <err> os: ARCH_EXCEPT with reason 3

    [00:00:00.006,896] <err> os: r0/a1: 0x00000003 r1/a2: 0x0000000b r2/a3: 0x0000000a
    [00:00:00.006,927] <err> os: r3/a4: 0x00016331 r12/ip: 0x20005140 r14/lr: 0x000163bb
    [00:00:00.006,927] <err> os: xpsr: 0x41000018
    [00:00:00.006,927] <err> os: Faulting instruction address (r15/pc): 0x0001022c
    [00:00:00.006,958] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:00.006,988] <err> os: Fault during interrupt handling

    [00:00:00.007,019] <err> os: Current thread: 0x20001318 (logging)
    [00:00:00.788,482] <err> fatal_error: Resetting system
    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    Starting Beacon Demo
    [00:00:00.000,488] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
    36 f0 e5 0e 87 68 48 fb 02 fd 9f 82 cc 32 e5 7b |6....hH. .....2.{
    91 b1 5c ed |..\.
    [00:00:00.002,563] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.002,593] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.002,624] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 54.58864 Build 1214809870
    [00:00:00.003,509] <inf> bt_hci_core: Identity: CE:0B:6F:A3:CD:64 (random)
    [00:00:00.003,570] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x118f, manufacturer 0x0059
    [00:00:00.003,601] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x118f
    Bluetooth initialized
    Beacon started, advertising as CE:0B:6F:A3:CD:64 (random)
    [00:00:00.008,758] <err> mpsl_init: MPSL ASSERT: 112, 1706
    [00:00:00.008,789] <err> os: ***** HARD FAULT *****
    [00:00:00.008,789] <err> os: Fault escalation (see below)
    [00:00:00.008,789] <err> os: ARCH_EXCEPT with reason 3

    [00:00:00.008,819] <err> os: r0/a1: 0x00000003 r1/a2: 0x0000000b r2/a3: 0x0000000a
    [00:00:00.008,819] <err> os: r3/a4: 0x00016331 r12/ip: 0x20005140 r14/lr: 0x000163bb
    [00:00:00.008,819] <err> os: xpsr: 0x41000018
    [00:00:00.008,850] <err> os: Faulting instruction address (r15/pc): 0x0001022c
    [00:00:00.008,880] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:00.008,880] <err> os: Fault during interrupt handling

    [00:00:00.008,941] <err> os: Current thread: 0x20001318 (logging)
    [00:00:00.790,191] <err> fatal_error: Resetting system
    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    Starting Beacon Demo
    [00:00:00.000,488] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
    36 f0 e5 0e 87 68 48 fb 02 fd 9f 82 cc 32 e5 7b |6....hH. .....2.{
    91 b1 5c ed |..\.
    [00:00:00.002,532] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:00.002,563] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:00.002,593] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 54.58864 Build 1214809870
    [00:00:00.003,509] <inf> bt_hci_core: Identity: CE:0B:6F:A3:CD:64 (random)
    [00:00:00.003,540] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x118f, manufacturer 0x0059
    [00:00:00.003,570] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x118f
    Bluetooth initialized
    Beacon started, advertising as CE:0B:6F:A3:CD:64 (random)
    [00:00:00.014,862] <err> mpsl_init: MPSL ASSERT: 112, 1706
    [00:00:00.014,862] <err> os: ***** HARD FAULT *****
    [00:00:00.014,892] <err> os: Fault escalation (see below)
    [00:00:00.014,892] <err> os: ARCH_EXCEPT with reason 3

    [00:00:00.014,892] <err> os: r0/a1: 0x00000003 r1/a2: 0x00000009 r2/a3: 0x00000008
    [00:00:00.014,923] <err> os: r3/a4: 0x00016331 r12/ip: 0x20005140 r14/lr: 0x000163bb
    [00:00:00.014,923] <err> os: xpsr: 0x41000018
    [00:00:00.014,923] <err> os: Faulting instruction address (r15/pc): 0x0001022c
    [00:00:00.014,984] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:00.014,984] <err> os: Fault during interrupt handling

    [00:00:00.015,014] <err> os: Current thread: 0x20001318 (logging)
    [00:00:00.656,860] <err> fatal_error: Resetting system
    *** Booting nRF Connect SDK v3.5.99-ncs1 ***
    Starting Beacon Demo
    [00:00:00.000,488] <inf> bt_sdc_hci_driver: SoftDevice Controller build rev

    >>

    I.e. resets over and over after HARDFAULT :-(

  • Hi,

    That is expected, and matches that the HFXO clock is not started due to a HW issue.

  • OK, thanks - apparently, I have been using HFINT-clock for I2S/UART/SPI peripherals without noticing. For reference; is there any config-options that enables HFXO *directly*, or must this be configured via code/clock-API ??

  • A few drivers will start the HFXO via the clock control API (which you also used with the snippet from earlier in this thread), but there is no generic config that states that the HFXO shoudl always be used for periptherals that use the high-frequency clock. So if you need to request the HFXO when you need it, and release it when you are done (this is important for low power operation, as if not, it will continue to run even if it is not in use).

  • Okay, so now I have a board that *seem to have working HFXO connection*.

    I makes its way through the DO-WHILE loop, indicating that clock really has started.

    However, it ends in crash&burn just a little later:

    <<

     *** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
    Starting Beacon Demo
    Clock has started
    ALIVE: 0
    ALIVE: 0
    ALIVE: 0
    ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:331
            command opcode 0x0c03 timeout with err -11
    [00:00:10.000,610] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000003  r2/a3:  0x00000002
    [00:00:10.000,640] <err> os: r3/a4:  0x0000014b r12/ip:  0x00000004 r14/lr:  0x00003bed
    [00:00:10.000,640] <err> os:  xpsr:  0x41000000
    [00:00:10.000,640] <err> os: Faulting instruction address (r15/pc): 0x00003bf8
    [00:00:10.000,671] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:10.000,732] <err> os: Current thread: 0x20001158 (sysworkq)
    ÿ00:00:10.057,830] <err> fatal_error: Resetting system

    >>

    Continuing like this w. Reset-cycles yielding same output as above:

    If opcode consist of a group-field in upper 6 bits (of 16-bit value) then the OGF-value=0x03 - which translates to ??? (baseband group?)

  • Update: I think you can forget about errors reported on console log above. I had additional config symbols for our custom board - now investigating what should be taken out (but of course, if you find something obvious  in the console log feel free to comment on it). Going back to the NRF52840DK-build, running it I can successfully read EddystoneURL(=http://www.zephyrproject.org) from our board.

    Conclusion: we have a shaky HF-XTAL design on our board, or something's gone wrong during assembly.

    If you have no further comments, you may close the case. Thanks again for all help!Thumbsup

Reply
  • Update: I think you can forget about errors reported on console log above. I had additional config symbols for our custom board - now investigating what should be taken out (but of course, if you find something obvious  in the console log feel free to comment on it). Going back to the NRF52840DK-build, running it I can successfully read EddystoneURL(=http://www.zephyrproject.org) from our board.

    Conclusion: we have a shaky HF-XTAL design on our board, or something's gone wrong during assembly.

    If you have no further comments, you may close the case. Thanks again for all help!Thumbsup

Children
No Data
Related