Edge Impulse enables developers to create the next generation of intelligent device solutions with embedded Machine Learning. This repository contains the Edge Impulse firmware for the Arduino Portena H7 development board. This device supports all Edge Impulse device features, including ingestion, remote management and inferencing.
Note: Do you just want to use this development board with Edge Impulse? No need to build this firmware. See the instructions here for a prebuilt image and instructions. Or, you can use the data forwarder to capture data from any sensor.
- Arduino Portenta H7 development board.
- Arduino Portenta Vision Shield (LoRa or Ethernet).
The arduino-cli tool is used to build and upload the Edge Impulse firmware to the Arduino Portenta H7 board. Use following link for download and installation procedure:
The Edge Impulse firmware depends on some libraries and the Mbed core for Arduino. These will be automatically installed if you don't have them yet.
- Arduino IDE (required for Windows users)
Installing Arduino IDE is a requirement only for Windows users. macOS and Linux users can use either the Arduino CLI or IDE to build the application.
- Download and install the Arduino IDE for your Operating System.
- In Tools -> Board -> Boards Manager, search for
portenta
and install the Arduino Mbed OS Portenta Boards v2.8.0.
-
Build the application:
./arduino-build.sh --build
-
Flash the application:
./arduino-build.sh --flash
-
Build and flash the application:
./arduino-build.sh --all
-
Build the application:
arduino-win-build.bat --build
-
Flash the application:
arduino-win-build.bat --flash
-
Build and flash the application:
arduino-win-build.bat --all
- In Tools -> Board -> Boards Manager, search for
portenta
and install the Arduino Mbed OS Portenta Boards v2.8.0. - In Arduino Menu -> Preferences, check the location of the preferences.txt file (ie: /Users/aureleq/Library/Arduino15/).
- Copy the
boards.local.txt
file into the Arduino Mbed Portenta directory, for instance:/Users/aureleq/Library/Arduino15/packages/arduino/hardware/mbed_portenta/2.8.0
. - Open the
firmware-arduino-portenta-h7.ino
, select the Arduino Portenta H7 (M7 core) board and the Flash Split 2 MB M7 + M4 in SDRAM. - Build and flash the application using the Upload button.
⚠️ It can take up to an hour depending on your computer resources
Extract the contents of the exported Arduino
library and replace src/edge-impulse-sdk
, src/tflite-model
and src/model-parameters
in the project
accordingly.
-
Not flashing? You can double tap the button on the board to put it in bootloader mode.
-
Invalid DFU suffix signature?
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! dfu-util: Cannot open DFU device 2341:035b dfu-util: No DFU capable USB device available Upload error: Error: 2 UNKNOWN: uploading error: uploading error: exit status 74
Having the above issues? Then copy
20-arduino.rules
to/etc/udev/rules.d/
and try again. -
#include "UsefulBuh.h" error?
#include "UsefulBuf.h" ^~~~~~~~~~~~~ compilation terminated. exit status 1 Error compiling for board Arduino Portenta H7 (M7 core).
Add the boards.local.txt in your Arduino IDE application folder
-
Failed to allocate TFLite arena (error code 1) / Failed to run impulse (-6)
Inferencing settings:
Image resolution: 96x96
Frame size: 9216
No. of classes: 1
Taking photo...
Failed to allocate TFLite arena (error code 1)
Failed to run impulse (-6)
You get the above error when there's not enough (contiguous) memory to allocate TFLite arena. This can be caused by different reasons
- Heap fragmentation
- Not enough RAM/heap.
In the case of (1) you may want to allocate the tensor arena statically by defining "-DEI_CLASSIFIER_ALLOCATION_STATIC"
in arduino-build.sh
or boards.local.txt
. If the problem still persists, then it may be that there's not enough RAM/heap for your model and this application. Currently the heap is placed in a 512
k RAM segment.
- Failed to encode frame as JPEG (4)
Inferencing settings:
Image resolution: 96x96
Frame size: 9216
No. of classes: 1
Taking photo...
Begin output
Failed to encode frame as JPEG (4)
There's not enough (contiguous) memory to allocate the jpeg buffer. Try increasing the jpeg_buffer_size
. If the problem still persists this may be due
to heap fragmentation. Try statically allocating jpeg_buffer
.