Getting internal clocks to run on NRF54l15

Been trying to set up a project to run some basic openthread as a proof of concept project. I based much of it off the CLI example and SDK. I have gotten stuck where my code doesnt seem to be loading the internal clock correctly. I tried following this post as it seems very similar:

nrf54L15 LFRC 32KHz clock configuration issue - Nordic Q&A - Nordic DevZone - Nordic DevZone

but alas no. My program is currently hung up before entering main, somewhere in the clock setup. Heres the current trace:

Program received signal SIGTRAP, Trace/breakpoint trap.
nrfx_grtc_syscounter_get (p_counter=p_counter@entry=0x20016770 <z_interrupt_stacks+1696>) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/modules/hal/nordic/nrfx/drivers/src/nrfx_grtc.c:282
282 *p_counter = nrfy_grtc_sys_counter_get(NRF_GRTC);
(gdb) bt
#0 nrfx_grtc_syscounter_get (p_counter=p_counter@entry=0x20016770 <z_interrupt_stacks+1696>) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/modules/hal/nordic/nrfx/drivers/src/nrfx_grtc.c:282
#1 0x0004beca in counter () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/drivers/timer/nrf_grtc_timer.c:88
#2 0x0004bf10 in sys_clock_cycle_get_32 () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/drivers/timer/nrf_grtc_timer.c:434
#3 0x00005c72 in z_log_msg_commit (msg=0x200013e0 <buf32>) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/subsys/logging/log_core.c:705
#4 0x00005f3e in z_impl_z_log_msg_static_create (source=<optimized out>, desc=..., desc@entry=..., package=package@entry=0x20016808 <z_interrupt_stacks+1848> "\a", data=data@entry=0x0 <command_handler_init()>)
at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/subsys/logging/log_msg.c:332
#5 0x00036f94 in z_log_msg_static_create (data=0x0 <command_handler_init()>, package=0x20016818 <z_interrupt_stacks+1864> ""\r", desc=..., source=<optimized out>)
at C:/Users/jogarvey/Documents/git/cuelights_control_nora/build/cuelights_control_nora/zephyr/include/generated/zephyr/syscalls/log_msg.h:120
#6 z_impl_k_mutex_lock (mutex=0x20000da8 <mbedtls_threading_psa_rngdata_mutex>, timeout=...) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/kernel/mutex.c:126
#7 0x0003ff9a in psa_get_initialized () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/modules/crypto/oberon-psa-crypto/library/psa_crypto.c:88
#8 0x00041738 in psa_crypto_init () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/modules/crypto/oberon-psa-crypto/library/psa_crypto.c:6051
#9 0x0004b954 in entropy_psa_crypto_rng_init (dev=<optimized out>) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/drivers/entropy/entropy_psa_crypto.c:19
#10 0x000639f6 in do_device_init (dev=0x6a410 <__device_dts_ord_4>) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/kernel/init.c:315
#11 0x00036c42 in z_sys_init_run_level (level=level@entry=INIT_LEVEL_PRE_KERNEL_1) at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/kernel/init.c:374
#12 0x00036e1c in z_cstart () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/kernel/init.c:797
#13 0x00009dbc in z_prep_c () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/arch/arm/core/cortex_m/prep_c.c:220
#14 0x00009bc0 in z_arm_reset () at C:/Users/jogarvey/Documents/git/cuelights_control_nora/zephyr/arch/arm/core/cortex_m\reset.S:207
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

Im fairly conviced the clock isnt connecting through as the syscounter doesnt seem to change (assuming i tracked it correctly)



ive been messing around with the prj.conf settings and am currently sitting at:

#
# Copyright (c) 2020 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Enable logging for CDI messages
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_LOG_MODE_DEFERRED=y
CONFIG_CLOCK_CONTROL_LOG_LEVEL_DBG=y
CONFIG_PRINTK=y
# CONFIG_EARLY_CONSOLE is disabled to avoid timestamp reads before GRTC is ready
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y

# Enable GPIO for button and buzzer
CONFIG_GPIO=y

# Enable I2C master for communicating with RPI
CONFIG_I2C=y

### OpenThread ###
CONFIG_OPENTHREAD=y

# Bluetooth or Multithread
CONFIG_CLI_SAMPLE_MULTIPROTOCOL=n # uses whatever
CONFIG_CLI_SAMPLE_LOW_POWER=n # BLE only

# Network shell
CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

# Increase Settings storage size
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000

# Enable OpenThread features set
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y

CONFIG_GPIO_SHELL=y

### Clock ###
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_250PPM=y
CONFIG_NRF_GRTC_START_SYSCOUNTER=y
in my dts i have:
&hfxo {
    status = "disabled";
};

&lfxo {
    status = "disabled";
};

&clock {
    status = "okay";
};
The code all built and ran before i added the clock stuff. I'm sure I'm missing something obvious her, software isn't my usual world. Let me know if theres more info i can add
Parents
  • Hi,

     

    Based on frames 3-7, it looks like the firmware is trying to log.

    Q1: Is there any log output over uart that you can share?

    Q2: Do you have any sub-images, like mcuboot, enabled? If yes, you need to add 32k RC oscillator configuration to the configuration there as well. 

    in my dts i have:
    &hfxo {
        status = "disabled";
    };

    For any application that uses the radio (and some other functions, like RC osc calibration), you will need to use HFXO.

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Based on frames 3-7, it looks like the firmware is trying to log.

    Q1: Is there any log output over uart that you can share?

    Q2: Do you have any sub-images, like mcuboot, enabled? If yes, you need to add 32k RC oscillator configuration to the configuration there as well. 

    in my dts i have:
    &hfxo {
        status = "disabled";
    };

    For any application that uses the radio (and some other functions, like RC osc calibration), you will need to use HFXO.

     

    Kind regards,

    Håkon

Children
  • 1. The logs dont output, they did before this clock issue, but something here is spinning before that gets initialized. Our good friend claude (ai) was telling me that the logging was coming up after the clock stuff so those calls might be sticking. 

    2. Are you saying i need a physical crystal? or just that hfxo needs to be enabled.

    As for submodules i do have a bootloader folder that has mcuboot that came from either zephyr or west or the nrf download. I dont believe im using it (following the cli example which could be using it) so all my config stuff is in the main prj.conf, the zephyr.dts file looks like the clocks are all being set as expected

  • You need a physical crystal to be present. Otherwise you can't calibrate the LFRC as there is nothing to calibrate against. LFRC calibration requires HFXO.

  • I have added to the dts

    &hfxo {
        load-capacitors = "internal";
        load-capacitance-femtofarad = <15000>;
    };

    which should set up the internal 32M as i understand it
    prj.conf now matches the post i linked as well. 

    ### Clock ###
    CONFIG_CLOCK_CONTROL=y
    CONFIG_CLOCK_CONTROL_NRF=y

    CONFIG_NRFX_CLOCK=y
    CONFIG_NRF_GRTC_TIMER=y
    CONFIG_NRF_GRTC_START_SYSCOUNTER=y
    CONFIG_NRFX_GRTC=y
    CONFIG_NRFX_CLOCK_LF_SRC_RC=y

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC_CALIBRATION=y
    CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_LF_ALWAYS_ON=y


    doing this my error has changed to 
    nrf/drivers/mpsl/clock_control/nrfx_power_clock.h:11:2: error: #error "Expected disabled nrfx_clock."
    if i disable the config nrfx clock though i end up right back where i was

  • sorry if im totally missing something here, doesnt this suggest that the internal xtal can be used for the hfxo? or can it not calibrate off that

  • This is the first time you mentioned using an Ublox NORA-B2 module. We cannot read your mind.

    And yes, these modules should have the HFXO crystal included. Might want to check ublox documentation how to to configure the NCS SDK.

Related