Hi All.
Due to complexity growth of my project I am willing to shift to Arduino GIGA from old style Mega.
Different from the Mega the Giga has a 32-bit dual core CPU (M7 and M4) and I wanted to try the use of variable interchange between the two cores. I think it's pretty "unfair" use the serial port to pass variable values so I have tried to use the RPC calls for variable interchange.
Here is a very simple sketch "the blink" to be loaded to both M7 (main program) and M4.
While M4 is constantly running a simple blink example with "blink" delay as a variable the M7 is listening to the serial port and whenever a new value is detected it updates the blink variable via RPC and so the blink on M4 is updated accordingly.
Pretty straightforward I attach the code:
M7 code:
#include <RPC.h>
int blink = 1000; // Default blink delay in milliseconds
void setup() {
Serial.begin(115200); // Initialize Serial communication
RPC.begin(); // Initialize RPC communication
Serial.println("M7 Core is ready. Send an integer to update blink delay.");
}
void loop() {
if (Serial.available() > 0) {
int newBlink = Serial.parseInt(); // Read an integer from Serial
if (newBlink > 0) {
blink = newBlink;
// Send the updated blink value to the M4 core
RPC.write("blink", blink);
Serial.print("Updated blink delay: ");
Serial.println(blink);
}
}
}
M4 code:
#include <RPC.h>
int blink = 1000; // Default blink delay in milliseconds
const int ledPin = LED_BUILTIN; // Onboard LED pin
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as output
RPC.begin(); // Initialize RPC communication
// Properly bind the "blink" variable
RPC.bind("blink", &blink);
}
void loop() {
// Blink the onboard LED with the updated delay
digitalWrite(ledPin, HIGH);
delay(blink);
digitalWrite(ledPin, LOW);
delay(blink);
}
The M7 compiles correctly.
The M4 does not.
I have tried use different Os (WIndows and MAC) Arduino IDE is updated, all the packages are update, nothing. The compiler throws me this error:
/Users/Steff_Alfr/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.2.1/libraries/rpclib/src/rpc/dispatcher.inl: In instantiation of 'void rpc::detail::dispatcher::bind(const string&, F) [with F = int*; std::__cxx11::string = std::__cxx11::basic_string<char>]':
/Users/Steff_Alfr/Dropbox (Ing.Elettr.)/ENGENHARIA-COMMITMENTS/23.WiseNeuro/ELECTRONIC.ENGINEERING/03.EVCLID/CODING/ARDUINO/DUAL_CORE/Blink_M4/Blink_M4.ino:11:27: required from here
C:\Users\laspi\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.2.1\libraries\rpclib\src/rpc/dispatcher.inl:7:58: error: no type named 'result_kind' in 'struct rpc::detail::func_kind_info<volatile int*>'
bind(name, func, typename detail::func_kind_info<F>::result_kind(),
^~~~~~~~~~~~~
C:\Users\laspi\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.2.1\libraries\rpclib\src/rpc/dispatcher.inl:8:46: error: no type named 'args_kind' in 'struct rpc::detail::func_kind_info<volatile int*>'
typename detail::func_kind_info<F>::args_kind());
Using library RPC at version 1.0 in folder: /Users/Steff_Alfr/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.2.1/libraries/RPC
Using library rpclib at version 1.0.0 in folder: /Users/Steff_Alfr/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.2.1/libraries/rpclib
Using library openamp at version 1.0 in folder: /Users/Steff_Alfr/Library/Arduino15/packages/arduino/hardware/mbed_giga/4.2.1/libraries/openamp_arduino
^~~~~~~~~~~
exit status 1
Compilation error: exit status 1
Can Anyone help me going further?
Best regards and thanks
Steve