I am participating in the K-Way + Arduino challenge and I am working on a solution that include the Nicla Sense ME running and Edge Impulse model and sending data through BLE, but the board can’t support BLE together with an Edge Impulse model.
I’ve tried different precompiled (optimized) mbed OS for the Nicla from this forum
This is the error with the Original BSP of the Nicla Sense ME 3.5.4:
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 --
The 3 options shared there doesn’t work for me, just receiving hard faults when trying them.
++ 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 --
I would appreciate it if you can help me here, please.
I think that the ArduinoBLE library I am using is very big, maybe having a simplified version of it could help.
I have had the same exact issues and I am going through the same steps (the v1-3 of libmbed and mbed_config files) and those didn’t work. @mcmchris, if you could, some details would be appreciated on how you got it working on PlatformIO, for those of us who don’t use that IDE often. Thanks!
OK, I was able to figure out how to import a project into PlatformIO (an extension in VS Code) and the project does compile and run. However, I get an out of memory error (Failed to run DSP process (-1002)) as soon as I make a BLE connection to my app. I remember running into memory issues on a prior Nicla Sense ME project and I ended up just using it as a shield on the MKR Wifi 1010. Obviously, with the K-way project we can’t do that.
Has anyone been successful in running an EI model and ArduinoBLE without running out of memory? I feel I have a pretty lightweight accelerometer model with a 1 second inference window. Any suggestions? Thanks!
Hi all, apologies for the multiple messages, but I found a project that was able to figure out the memory constraint issue. See here. You have to go into the Arduino_BHY2 library and change the buffer size (WORK_BUFFER_SIZE) in BoschSensorTec.h. In his project, @nickbild changed the value from 2048 to 64, and that worked for me as well. I can now run inference and BLE at the same time, although I’m not sure what the second order effects are of changing the buffer size. For my relatively simple project, I think that should work.
@louis and @janjongboom , I’ve seen at least 3 people, plus myself, with this issue of running inference and BLE at the same time with the limited 64 kB SRAM of the Nicla Sense ME. We might want to get the word out that this change is required in order to not run out of memory while running an EI inference + BLE. Thanks! And thanks @nickbild for documenting the required change!
Hello @jlutzwpi, I tried this solution, but when I change the WORK_BUFFER_SIZE the serial monitor says ERR: Failed to run DSP process (-1002), at least it doesn’t show the memory issue.
Did you only change this parameter and then the system worked correctly?
Hi everybody, I’m also doing a project using an Edge Impulse model and sending the data trough BLE. @mcmchris said the solution was using Platform IO but I can’t get it to work, my question is can you use the same libraries that you used in Arduino? and also do you have to do any additional configuration in Platform IO? It’s my first time using it and I’m a littlle bit lost.
I have also tried the solution of changing the value of WORK_BUFFER_SIZE and compiling in Arduino IDE but it doesn’t work.
@mcmchris using different IDE should not be related at all. That is just an IDE, you can customize the compilers etc. Your repo lacks lib files. Also it would be better if you remove the Solution tick from there.
@jlutzwpi What I have found that, when we both run BLE and BHY we are limited with 70% of the RAM
void loop() {
BHY2.update();
Serial.println(“We are working fine!”);
delay(1000);
}
This occupies:
RAM: [======= ] 70.9% (used 45608 bytes from 64288 bytes)
If we increase to int all_readings[2250]; we get memory error. Sadly, changing that buffer size did not work for me. I am trying to find a way to use BHI260AP’s RAM instead.
Edit: @jlutzwpi I see now. Changing that buffer size will just save you as much as the change, so if you borderline out of RAM it is helpful but otherwise not.