Skip to content

edgeimpulse/firmware-arduino-portenta-h7

Repository files navigation

Edge Impulse firmware for Arduino Portenta H7

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.

Requirements

Hardware

Tools

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.

  1. Download and install the Arduino IDE for your Operating System.
  2. In Tools -> Board -> Boards Manager, search for portenta and install the Arduino Mbed OS Portenta Boards v2.8.0.

Building the application

With Arduino CLI

Linux and MacOs

  1. Build the application:

    ./arduino-build.sh --build
    
  2. Flash the application:

    ./arduino-build.sh --flash
    
  3. Build and flash the application:

    ./arduino-build.sh --all
    

Windows

  1. Build the application:

    arduino-win-build.bat --build
    
  2. Flash the application:

    arduino-win-build.bat --flash
    
  3. Build and flash the application:

    arduino-win-build.bat --all
    

Arduino IDE

  1. In Tools -> Board -> Boards Manager, search for portenta and install the Arduino Mbed OS Portenta Boards v2.8.0.
  2. In Arduino Menu -> Preferences, check the location of the preferences.txt file (ie: /Users/aureleq/Library/Arduino15/).
  3. 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.
  4. 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.
  5. Build and flash the application using the Upload button. ⚠️ It can take up to an hour depending on your computer resources

Using your own exported Arduino library from

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.

Troubleshooting

  • 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

  1. Heap fragmentation
  2. 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 512k 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.

About

Edge Impulse firmware for the Arduino Portenta H7 development board

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published