Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Nicla Sense ME Large Array Crash

    Nicla Sense ME Large Array Crash

    maxlo
    Member

    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: https://mbed.com/s/error?error=0x80FF0144&tgt=NICLA
    -- 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: https://mbed.com/s/error?error=0x80FF0144&tgt=NICLA
    -- 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
    
    Context:
    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: https://mbed.com/s/error?error=0x80FF013D&tgt=NICLA
    -- MbedOS Error Info --

     

    zgg
    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.

    zgg
    Long-established Member

    @mcmchris

    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: https://forum.arduino.cc/t/nicla-sense-me-out-of-memory/1180009/2

    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.
    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist