🛠 Programmer les deux cœurs M7 et M4 du GIGA R1 et les faire communiquer

Arduino GIGA R1 · avance · Schéma : IMG-giga-r1-a1-1-dual-core-rpc.svg — Le double cœur du STM32H747XI du GIGA R1 : Cortex-M7 à 480 MHz exécutant un programme Arduino, Cortex-M4 à 240 MHz exécutant MicroPython, reliés par un canal RPC.

Objectives

Leverage the unique feature of the GIGA R1 in the Arduino range: program the Cortex-M7 (up to 480 MHz) and the Cortex-M4 (up to 240 MHz) of the STM32H747XI separately, for example using Arduino/C++ on the M7 and MicroPython on the M4, then make them communicate via RPC. This is the ideal approach for isolating a real-time interface from an application layer.

Hardware

Complete Code

// GIGA R1 WiFi — coeur M7 (Arduino) : horloge maitre qui pousse le temps vers le M4
// Cote M4 : un script MicroPython recoit les messages via le canal RPC embarque.
#include <Arduino.h>
#include "RPC.h"

void setup {
  Serial.begin(115200);        // console USB du M7
  RPC.begin;                 // canal inter-cceurs M7 <-> M4
  Serial.println("M7 pret, envoi vers le M4");
}

void loop {
  RPC.printf("tick %lu\n", millis);   // message vers le coeur secondaire
  delay(1000);

  String msg = RPC.readStringUntil('\n'); // reponse eventuelle du M4
  if (msg.length) Serial.print("M4> ");
  Serial.print(msg);
}

On the M4 side (MicroPython, after uploading the MicroPython firmware to the secondary core):

# M4 MicroPython — lecture du canal RPC
import time
try:
    import rpc
    canal = rpc.RPC
    while True:
        msg = canal.read
        if msg:
            print("M7>", msg)
        time.sleep_ms(50)
except Exception as e:
    print("RPC indisponible:", e)

Expected Verification

The M7 console displays "M7 ready" and then starts sending regular messages; the M4 console (or the MicroPython monitor) receives lines such as "tick 1000", "tick 2000", etc. Both cores run in parallel: a busy while True loop on the M4 does not interrupt the heartbeat of the M7.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials