Running Edge Impulse on Multicore MCUs

TinyML models, especially those created using Edge Impulse Studio, are very efficient in terms of processing time. Single inference processes may be done in single milliseconds or tens of milliseconds. Nevertheless, in some critical systems, even such a short processing time that will block other CPU activities, is still too long. To get rid of this problem, the multicore microcontroller can be used, so one core can be employed to make ML operations while another core can take care of other critical operations without any blockers.

In this example, we will show how to use the Raspberry Pi RP2040 MCU, which consists of two Cortex-M0+ cores. Both cores can be utilized by the user for any tasks, while the interprocessor communication will be handled by shared memory and data queues. As an input sensor, the MPU-6050 IMU will be used for recognizing a few types of movement.

In the source code, you can find a code that is running on the core 0 (main function) and the code that is running on the core 1 (core1_entry). The data between cores are exchanged using two queues: data and results.

How do I get started?

First, get the Raspberry Pi Pico board, MPU-6050 module, breadboard and a few cables. Connect everything as shown below.

Connection of the Raspberry Pi Pico and MPU-6050 module
  1. Set up the Pico SDK.
  2. Clone the Multicore Pico Example repository.
  3. Go to Edge Impulse Studio and clone the Continuous motion recognition project into your account.
  4. In the project, go to Deploy, select C++ library and build.
  5. From the downloaded archive, copy edge-impulse-sdk, model-parameters and tflite-model directories into Multicore Pico Example.
  6. Build the project as described in the README.
  7. Deploy firmware to the Pico board and see results on the serial port.

We are very excited to see what you build with the Raspberry Pi Pico and Edge Impulse. Please post any questions you have and any projects you create over on our forum or tag @EdgeImpulse on our social media channels!

Subscribe

Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter