Open
Description
Hi!
I was trying to update M4 core with this library using an Arduino GIGA and it seems that it doesn´t work for me, maybe I'm not doing it in the right way. I want to upload the following sketch (that works fine if I upload it through USB) to both cores:
#include <RPC.h>
String currentCPU() {
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
return "M7";
} else {
return "M4";
}
}
void setup() {
if(currentCPU() == "M7") {
Serial.begin(9600);
while(!Serial);
RPC.begin();
}
if(currentCPU() == "M4") {
RPC.begin();
}
}
void loop() {
if(currentCPU() == "M7") {
String buffer = "";
while (RPC.available()) {
buffer += (char)RPC.read();
}
if (buffer.length() > 0) {
Serial.print(buffer);
}
}
if(currentCPU() == "M4") {
delay(1000);
RPC.println("Message to M7 from M4");
}
}
I have done all the steps without any problem and it seems that M7 downloads the code and updates fine. That's not the case for M4. If I upload "OTA on M4" code on M7, it uploads only for M7 but if I upload it on M4, it seems to be not working because it doesn't reset (I can't see Serial monitor because Serial.println() only works for M7, so I deleted the part that asks for Serial to read a response). What I have to do to upload the same sketch into both cores?
Thanks!