Can't allocate new thread ERR: Failed to run DSP process (-1002) Failed to run impulse (-5)

Hi, I get the above error when I run a model that previously worked fine. I tried all sorts of things. Installed the model again. Trained, tested and deployed the model again. Used a new board. I’,m using a Arduino Nano BLE (rev1) and a Macbook. Also updated the Arduino files. Nothing works. The inference starts but after a minute or so it produces the error.

Thanks for any advice in advance!

Hi @GerverA,

Can you share your project ID so that we can try to replicate the issue?

Yeah sure, here it is 283095

Hi @GerverA,

Please try this:

  • Deploy your model as an Arduino library
  • In the Arduino IDE, Sketch > Include Library > Add .ZIP library (and select your downloaded .zip file)
  • Open File > Examples > Fan_Demo_inferencing > nano_ble33_sense > nano_ble33_sense_fusion
  • Compile and upload that to your Nano BLE Rev1
  • Open a Serial Monitor

These steps worked for me on my Rev1. Please let me know if they also work for you.

Thanks @shawn_edgeimpulse,

Did you also tested the Edge Impulse binary? If so, do you know why that does not work?

Hi @shawn_edgeimpulse,

I followed your steps. But I don’t have the file > Fan_Demo_inferencing > nano_ble33_sense > nano_ble33_sense_fusion is the downloaded zip-file.

Kings regards,

Andre

Hi @GerverA,

It works when I tried the binary:

shawnhymel@Shawn-Hymel-LQNW70Y61L fan-demo-nano-33-ble-sense-v27 % ./flash_mac.command                   
You're using an untested version of Arduino CLI, this might cause issues (found: 0.34.2, expected: 0.18.x)
Finding Arduino Mbed core...
Finding Arduino Mbed OK
Finding Arduino Nano 33 BLE...
Finding Arduino Nano 33 BLE OK
Flashing board...
Device       : nRF52840-QIAA
Version      : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Address      : 0x0
Pages        : 256
Page Size    : 4096 bytes
Total Size   : 1024KB
Planes       : 1
Lock Regions : 0
Locked       : none
Security     : false
Erase flash

Done in 0.001 seconds
Write 353248 bytes to flash (87 pages)
[==============================] 100% (87/87 pages)
Done in 13.956 seconds
New upload port: /dev/cu.usbmodem1201 (serial)

Flashed your Arduino Nano 33 BLE development board.
To set up your development with Edge Impulse, run 'edge-impulse-daemon'
To run your impulse on your development board, run 'edge-impulse-run-impulse'
shawnhymel@Shawn-Hymel-LQNW70Y61L fan-demo-nano-33-ble-sense-v27 % screen /dev/tty.usbmodem1201 -b 115200
[screen is terminating]
shawnhymel@Shawn-Hymel-LQNW70Y61L fan-demo-nano-33-ble-sense-v27 % edge-impulse-run-impulse 
Edge Impulse impulse runner v1.22.0
WARN: You're running an outdated version of the Edge Impulse CLI tools
      Upgrade via `npm update -g edge-impulse-cli`
[SER] Connecting to /dev/tty.usbmodem1201
[SER] Serial is connected, trying to read config...
[SER] Retrieved configuration
[SER] Device is running AT command version 1.8.0
[SER] Started inferencing, press CTRL+C to stop...
LSE
Inferencing settings:
	Interval: 10.00 ms.
	Frame size: 300
	Sample length: 500 ms.
	No. of classes: 5
Starting inferencing, press 'b' to break
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 79 ms., Classification: 4 ms., Anomaly: 0 ms.): 
    Blade Fault: 0.99609
    Blocked Inlet: 0.00000
    Mount Fault: 0.00000
    Nominal: 0.00000
    Off: 0.00000
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 76 ms., Classification: 4 ms., Anomaly: 0 ms.): 
    Blade Fault: 0.00391
    Blocked Inlet: 0.00000
    Mount Fault: 0.00000
    Nominal: 0.00000
    Off: 0.99609
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 75 ms., Classification: 7 ms., Anomaly: 0 ms.): 
    Blade Fault: 0.00000
    Blocked Inlet: 0.00000
    Mount Fault: 0.99609
    Nominal: 0.00000
    Off: 0.00000
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 79 ms., Classification: 4 ms., Anomaly: 0 ms.): 
    Blade Fault: 0.02344
    Blocked Inlet: 0.00000
    Mount Fault: 0.97266
    Nominal: 0.00000
    Off: 0.00000
Starting inferencing in 2 seconds...
Sampling...
Predictions (DSP: 73 ms., Classification: 8 ms., Anomaly: 0 ms.): 
    Blade Fault: 0.00000
    Blocked Inlet: 0.00000
    Mount Fault: 0.00000
    Nominal: 0.00000
    Off: 0.99609

Can you tell me what commands you used to upload the binary and monitor inference running on the board?

As for the Arduino library, did you download the Arduino library (not the pre-compiled binary) from Edge Impulse? You should have a file named something like ei-fan-demo-arduino-1.0.xx.zip. In the Arduino IDE, you should be able to select Sketch > Include Library > Add .ZIP library and open that file.

Wait a few minutes, and the Arduino IDE should let you know that the library has been installed (you should see a pop-up in the bottom-right). You can also try closing and reopening the IDE. Then, you should see the options appear in File > Examples:

Hi @shawn_edgeimpulse,

The first part of your reply.
I get the same results. I can flash the model en it runs. But the problem is that it’s get stuck after a few inferences. And then produces this error:
Sampling…

Can’t allocate new thread

ERR: Failed to run DSP process (-1002)

Failed to run impulse (-5)
Did the model keep on running with you? It would be nice if this also could work.

Second reply.
I have the file nano_ble33_sense_fusion.ino in the Arduino IDE but get the folowing error:

/private/var/folders/63/y_7m144510z2z_hpvdm_2bq00000gn/T/.arduinoIDE-unsaved20231115-57711-18tf6ob.q8fa/nano_ble33_sense_fusion/nano_ble33_sense_fusion.ino:19:10: fatal error: Arduino_LSM9DS1.h: No such file or directory
#include <Arduino_LSM9DS1.h> //Click here to get the library: Arduino_LSM9DS1 - Arduino Reference
^~~~~~~~~~~~~~~~~~~
compilation terminated.

exit status 1

Compilation error: Arduino_LSM9DS1.h: No such file or directory

This is included at the top of the sketch:
/* Includes ---------------------------------------------------------------- */

#include <Fan_Demo_inferencing.h>

#include <Arduino_LSM9DS1.h> //Click here to get the library: Arduino_LSM9DS1 - Arduino Reference

#include <Arduino_LPS22HB.h> //Click here to get the library: Arduino_LPS22HB - Arduino Reference

#include <Arduino_HTS221.h> //Click here to get the library: Arduino_HTS221 - Arduino Reference

#include <Arduino_APDS9960.h> //Click here to get the library: Arduino_APDS9960 - Arduino Reference

Hi @GerverA,

I let my pre-compiled firmware run for longer, and it did indeed run into the same ERR: Failed to run DSP process (-1002) error after about a minute. This seems to indicate a memory leak. I have let the engineering team know about this issue.

I thought that the Arduino IDE installed dependencies when installing a .ZIP library, but it seems that it does not. Open the “Library Manager” on the left side, search for each of the required libraries, and install them:

  • Arduino_LSM9DS1
  • Arduino_LPS22HB
  • Arduino_HTS221
  • Arduino_APDS9960

I have been running the nano_ble33_sense_fusion.ino example for about 5 min with no errors.

Hi @shawn_edgeimpulse I am also getting same error but my code doesn’t work from starting ERR: Failed to run DSP process (-1002)
ERR: Failed to run classifier (-5)
getting the above errors. I am building a classification model on vibration data which needs to run on ESP32 WROOM .Here I am passing 40560 values as Input features using wavelet transformation on the values . Thank you for your valuable help in advance

@bapuji your issues seems to be unrelated (same error, but different board and different circumstances). Please create a new topic and follow the bug report template, thanks!