Prediction hangs, MBedOS stuck

I’m trying to deploy a CNN to my RP2040 connect board. 384 input features, 2D conv with 8 filters + 2D conv with 16 filters + Dense with 20 neurons + 5 outputs.

When I try to run the network, the board hangs and the orange led blinks 4 times slow, then 4 times fast. I read on this forum that it means the MBed OS is having problems.

If I turn on debug, the last print I get is about running the neural network, no hint on the problem.
Can somebody give me more info about this?

Update: even a single Conv 2D with 8 filters gives the same result.
It was working fine with only 3 classes, though. The problem started when I added 2 more classes.

Update: the same problems happen again and again. It’s a russian roulette if the model will work or not. Even using Conv 1D makes the board hang.

Hi @eloquentarduino,

Are you able to get debug information from GP0/1 as per this post? RPI Pico: LED blinks 4 long, 4 short, then again · Issue #316 · arduino/ArduinoCore-mbed · GitHub

Also, if you can share the project ID you used and which RP2040 board, I can try to replicate your error.

Thanks for reply Shawn.
Project id is 94474, board is Arduino Nano Rp2040 Connect.
I will try to connect to GP0/1 and see what I get from there. I point that that this also happens with the Arduino Nano 33 BLE Connect board.

Hi @eloquentarduino,

I took a look at your project, and it seems that you are using dense layers (instead of convolutional layers). I downloaded the Arduino library for the project and loaded the static_buffer example onto my Arduino RP2040 Connect (filling the buffer with raw values from one of your samples). Everything seems to be working on my end.

Did you change the model from a CNN to a DNN? What code are you using on the Arduino that causes the error to occur? Can you try the static_buffer example to see if it works?

I tried changing the network to see if it was a problem with the CNN vs DNN.
I reverted it back now.
I loaded the static_buffer example and it worked fine after my own sketch hanged again.
After the static_buffer worked, I loaded my sketch back again and it worked too!
My guess is that this is related to the Arduino IDE caching the Edge Impulse library: I’m making many iterations of the model (refining training data, refining network topology) and I’m likely to think that, after replacing the model, the IDE is not fully updating the code to load on the board.

In fact, when I loaded the static_buffer example, it took ~1 minute to compile, so it was clearly building all the stuff again. When I update my model and compile, it takes a few seconds.

I’m pretty sure this is the root cause for now.
Do you have experience on this?

Hi @eloquentarduino,

Glad to hear it’s working! I honestly don’t exactly know about the inner workings of Arduino, but it does seem to cache some things (e.g. object files when compiling a library). My guess is that if you don’t fully update the EI library, Arduino might be using some outdated object files that don’t line up with the new library code.

To update the library I moved the new files over the old ones and hit “replace all” on the OS dialog. Do you thing I should first delete the old one and then move the new ones to force a cache purge?

I can confirm now.
Developed a new model, loaded on the board and it hanged.
Restarted the IDE, it compiled all from scratch and the same model worked fine.

This is for sure a problem with the Arduino IDE caching, not the Edge Impulse library.

1 Like