Failed to allocate TFLite arena (error code 1) in STM32CubeIDE

Hello, I’m trying to deploy my image classification EI project on a STM32L475VG-IOT01A board. I downloaded the Cube.MX CMSIS-PACK from EI and followed the tutorial provided by Edge Impulse (https://docs.edgeimpulse.com/docs/using-cubeai). The only thing I changed from the provided code is the following:


static const long features[] = {0xffffff, 0xffffff, …, 0xffffff, 0xffffff, 0xffffff};

int get_feature_data(size_t offset, size_t length, float *out_ptr) {
memcpy(out_ptr, features + offset, length * sizeof(long));
return 0;
}


Actually I only changed the features type from float to long(but the problem is present also with the float type). When I build the project I have 0 errors and 0 warnings, but when I try to run I got this on Putty:

Anyone could help me with this problem?

Thanks,

Angelo

Hi Angelo,

The error means we can’t allocate enough memory to load the NN, the ST board is limited in RAM. Which MobileNet model are you using?
I would suggest trying with one of those 2 MobileNet v1 models as they require less RAM:

Best,
Aurelien

2 Likes

Thanks Aurelien, the peak RAM usage of the NN (115KB) was slightly less than the RAM on the board (128KB); I tried with MobileNetV1 0.2 with a smaller NN and it’s working well!

2 Likes

@ang_anz Yeah you’ll lose some static RAM here and there, f.e. stack so you’ll have a bit less RAM available than the full 128K.

1 Like