Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Nicla Sense ME Large Array Crash

    Nicla Sense ME Large Array Crash


    Hi, when uploading the code below, which is using a "large" array, to the Arduino Nicla Sense ME, the following error message comes up:

    ++ MbedOS Error Info ++
    Error Status: 0x80FF0144 Code: 324 Module: 255
    Error Message: Assertion failed: _stack_buffer != NULL
    Location: 0x430B9
    File: ./mbed-os/connectivity/drivers/ble/FEATURE_BLE/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/NRFCordioHCIDriver.cpp+186
    Error Value: 0x0
    Current Thread: main Id: 0x200051B4 Entry: 0x19E6F StackSize: 0xC00 StackMem: 0x20004590 SP: 0x2000508C
    For more info, visit:
    -- MbedOS Error Info --

    This does not happen if the array is small (e.g. 2 instead of 800), or if the line "BHY2.begin();" is commented out. The example sketches work, but just adding a large array to the code leads to this error.
    The Code:

    #include "Arduino_BHY2.h"
    int all_readings[800];
    void setup() {
    all_readings[0] = 0;
    BHY2.begin(); // if this command is commented out: no error is thrown

    void loop() {
    BHY2.update(); // this line does not impact the error, so commenting it out has no effect on the error.

    19 REPLIES 19

    I am having the same problem that him when I try to run these libraries at the same time: 

    #include "Nicla_System.h"
    #include "Arduino_BHY2.h"  //Click here to get the library: http://librarymanager/All#Arduino_BHY2
    #include <ArduinoBLE.h>

    This is my error: 


    Edge Impulse Sensor Fusion Inference
    ++ MbedOS Error Info ++
    Error Status: 0x80FF0144 Code: 324 Module: 255
    Error Message: Assertion failed: _stack_buffer != NULL
    Location: 0x4B381
    File: NRFCordioHCIDriver.cpp+186
    Error Value: 0x0
    Current Thread: main Id: 0x20003FA0 Entry: 0x22583 StackSize: 0xC00 StackMem: 0x20003FE8 SP: 0x20004AE4 
    For more info, visit:
    -- MbedOS Error Info --


    I tried the 3 versions of the precompiled OS you shared, but then I received a Hard fault, different than the original one.


    ++ MbedOS Fault Handler ++
    FaultType: HardFault
    R   0: 2000BA28
    R   1: 00000001
    R   2: 20006564
    R   3: 6C646E61
    R   4: 2000372C
    R   5: 00000026
    R   6: 0005ECD9
    R   7: 00000000
    R   8: 00000000
    R   9: 00000000
    R  10: 00000000
    R  11: 00000000
    R  12: FFFFFFFF
    SP   : 20007488
    LR   : 0001F811
    PC   : 6C646E60
    xPSR : 21070000
    PSP  : 20007468
    MSP  : 2000FFC0
    CPUID: 410FC241
    HFSR : 40000000
    MMFSR: 00000000
    BFSR : 00000001
    UFSR : 00000000
    DFSR : 00000000
    AFSR : 00000000
    Mode : Thread
    Priv : Privileged
    Stack: PSP
    -- MbedOS Fault Handler --
    ++ MbedOS Error Info ++
    Error Status: 0x80FF013D Code: 317 Module: 255
    Error Message: Fault exception
    Location: 0x6C646E60
    Error Value: 0x2000A594
    Current Thread: main Id: 0x20003F80 Entry: 0x22557 StackSize: 0xC00 StackMem: 0x200068D0 SP: 0x20007488 
    For more info, visit:
    -- MbedOS Error Info --


    Long-established Member

    Hi @mcmchris 

    do you mean you get crash/fault even when using the official  mbedos libraries from the IDE's Board support package?

    could you share the version of the board support package and the version of the Arduino IDE?

    how about using the latest Arduino IDE and board support package for Nicla Sense?


    for the precompiled libraries, I believe there have been a lot of changes which might have broken the compabilities. 

    some quick notes for helping you with the troubleshooting:

    if your sketch uses BLE, it will try to allocate  a big chunk of RAM memory for the BLE stack and when that allocation fails, you get a crash.

    in this case, you could try to minimize the memory consumption in your sketch, for example minimize the size of global variables, arraies, etc.

    if your sketch does not require BLE, you could disable the BLE (I can share how if you want) and this should resolve the issue very easily.


    Hi, thanks for your quick response, 

    1. Yeah, I get the first error shown before when using the original BSP mbed OS (3.5.4) and 2.0.3 New Arduino IDE. 

    2. The precompiled libraries you shared years ago are the ones creating the las shown error.

    3. My project needs BLE, I am working with an ML model + the ArduinoBLE library, I think that this is to much for the Nicla Sense ME.

    Long-established Member


    Thanks for sharing the info. 

    based on some  experiments, there is about ~4KB RAM available for storing global variables when you use BLE.

    One thing that could be tried is to shrink the ML model to lower the memory consumption, not sure if this is possible with the Edge Impulse tools.

    The other option is to run the ML model on the BHI260AP chip which has larger memory.

    Hi @zgg,

    This also an issue for me as well. I tried your versions, but still getting the same error.

    I have asked my question in Arduino forum as well:

    I appreciate if you can explain the steps you take to compile lib for the Nicla as it is not supported by mbed os directly.