Zephyr Project Startup Hardfault using the Matter LightBulb example.

I have been attempting to load a board we manufactured with the Matter Lightbulb example. The code loads and starts to function but I immediately get the following Hard fault.

Some background. This board is simply the nrf52840, with the same LEDs and two of the buttons form the nrf52840-DK board. 
We do not have the 32Khz crystal (which was a problem for me initially to get the code to start). Has anyone seen the code simply fail like this? Any thoughts on why the code would start up and then fault like this. I had single stepped through most of the init function for the main class, so I know it is executing code.

Are there specific hardware requirements when using matter? For example, is it 100% necessary that the design has the 32Khz crystal attached?  Does the device need to use the switching power supplies? 

Thanks for any advice. I realize this question is hard to answer. 

  • Hello,

    I had single stepped through most of the init function for the main class, so I know it is executing code.

    Does this hardfault trigger at a particular line of code during the initialization? If so, where?

    This board is simply the nrf52840, with the same LEDs and two of the buttons form the nrf52840-DK board. 
    We do not have the 32Khz crystal (which was a problem for me initially to get the code to start). Has anyone seen the code simply fail like this?

    Are you able to successfully run other examples from the SDK on your board, such as the hello_world from Zephyr (to verify that your toolchain and debugger is functioning as it should), or any of the BLE applications (to verify that the rest of your hardware is functioning as expected)?

    This board is simply the nrf52840, with the same LEDs and two of the buttons form the nrf52840-DK board. 

    Have you made your own board files for this board, and used this instead of the nRF52840 DK board files as the build target for the Matter lightbulb application?

    Best regards,
    Karl

  • Originally, I was trying to get blinky to function on the board. I was having problems and then I found out I needed to set 

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y to get it to function. This is what led my initial question of if it is necessary to have the 32Khz crystal to make these things work at all. This took a minute to figure out until I tested the exact same .hex file on our board and the nrf52840-DK board (which I have because I wasn't going to think of doing this without an actual demo board in hand). Finally I realized that the difference was the crystal. After making the change to the .conf file, blinky worked find on our board.

    I decided to take a big step and move to the matter-lightbulb example. The code executes and I can single step to a point. The downside, of course, is that this is an OS so I can't step through everything linearly. 

    I decided to buckle down and take some more detailed notes. I rebuilt the project and started it in oxygen again. 
    The fault happens reliably as  HardFault exception at 0x0003116A.(yes very different from the fault address in the first post)
    If I read this correctly, the Fault is being generated in this location, and looking at the map file it appears that this is m_assert_handle. 
    So apparently, I am hitting an MPSL assert for some reason. I haven't figured what causes this yet, but that should be next.

    Currently my prj.conf (prj_no_dfu.conf) is
    # Enable CHIP
    CONFIG_CHIP=y
    CONFIG_CHIP_PROJECT_CONFIG="src/chip_project_config.h"
    # 32773 == 0x8005 (example lighting-app)
    CONFIG_CHIP_DEVICE_PRODUCT_ID=32773
    CONFIG_STD_CPP14=y
    
    # Enable CHIP pairing automatically on application start.
    CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
    
    # Add support for LEDs and buttons on Nordic development kits
    CONFIG_DK_LIBRARY=y
    CONFIG_PWM=y
    
    # Bluetooth Low Energy configuration
    CONFIG_BT_DEVICE_NAME="MatterLight"
    
    # Other settings
    CONFIG_THREAD_NAME=y
    CONFIG_MPU_STACK_GUARD=y
    CONFIG_RESET_ON_FATAL_ERROR=n
    CONFIG_CHIP_LIB_SHELL=y
    
    # Disable Matter OTA DFU
    CONFIG_CHIP_OTA_REQUESTOR=n
    
    # Disable QSPI NOR
    CONFIG_CHIP_QSPI_NOR=n
    
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_SYNTH=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_EXT_LOW_SWING=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_EXT_FULL_SWING=n
    
    CONFIG_SCHED_CPU_MASK=y
    CONFIG_THREAD_ANALYZER=y

  • No - I haven't tried any other BLE programs yet, but perhaps I should at this point.


  • NOPE THIS IS WRONG.

    I think my issue is coming from this point in the code at ISR_DIRECT_PM() or just before it:

    static void mpsl_radio_isr_wrapper(const void *args)
    {
    	ARG_UNUSED(args);
    
    	MPSL_IRQ_RADIO_Handler();
    
    	ISR_DIRECT_PM();
    }
    

  • Ok, this took too much effort, but I connected the serial port and captured:
    E: MPSL ASSERT: 112, 2185
    E: ***** HARD FAULT *****
    E: Fault escalation (see below)
    E: ARCH_EXCEPT with reason 3

    E: r0/a1: 0x00000003 r1/a2: 0x2000efe0 r2/a3: 0x2000efe0
    E: r3/a4: 0x20016f88 r12/ip: 0x00000000 r14/lr: 0x0003115f
    E: xpsr: 0x61000018
    E: s[ 0]: 0x00000000 s[ 1]: 0x0000e349 s[ 2]: 0x00323131 s[ 3]: 0x00000000
    E: s[ 4]: 0x00000000 s[ 5]: 0x0000be03 s[ 6]: 0x00000000 s[ 7]: 0x40008000
    E: s[ 8]: 0x20000008 s[ 9]: 0xe000e000 s[10]: 0x00000100 s[11]: 0x0000d9ff
    E: s[12]: 0x0004e8bd s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000
    E: fpscr: 0x00000000
    E: Faulting instruction address (r15/pc): 0x0003116a
    E: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    E: Fault during interrupt handling

    E: Current thread: 0x2000efe0 (idle)
    E: Halting system

    So MPSL ASSERT makes sense. 

    Can you help on what file 112, line 2185 equate to??

Related