Did you run the " RPC Examples" in the document you referenced to see if there will be an error? Note also the "restrictions to using the RPC library with MicroPython"
The trivial sketch was OK on M7. Then I moved it over to M4, installed micropython, and tried that approach.
So perhaps I try the pure C++ approach in the document and see if it is any different. Was that your idea or were you getting at some other aspect to verify?
That is, I believe, what I am working through with the above document.
I got a little further today. I found that if I use the CPP version of the server code for the M7, then the M4 comes up and runs. Specifically, this bit works as expected:
RPC.begin(); //boots M4
That appears to narrow the issue down to the python aspect of this.
Thanks for your responding there. It is working now.
The way I misinterpreted the tutorial was that it says the begin needs to be on the M7 to start the M4. Which is fine. It is also the case that the M4 needs the begin as well. The scary OS error -1 message was its way of indicating that. All seems more obvious with hindsight.
Python is now doing its rpc call to the M4.
A cute little message is now popping up on the oled display running on the M4.
Thanks again. It is always good to have some encouragement on these things.
But that might not be only reason. After getting it working for a while, there are still times when it produces that OS Error -1. Rebooting it seems to clear it now though.
I am facing this problem as well. If I reset the board, I can run a python script one time, and the M7 successfully interacts with the code on the M4 (previously uploaded to flash with the Arduino IDE). I have the flash split 1.5MB to the M7 and 0.5MB to the M4. Once the script ends, if I try to run it again, I get the following error:
File "msgpackrpc.py", line 179, in start
OSError: -1
Restarting the board seems to be the only way out of this problem. Is there some way I should be releasing the RPC connection before terminating the python script? I don't see any additional methods in MsgPackRPC that might be useful for this. Also, where do I find the msgpackrpc.py source file? It's not anywhere in the MicroPython source that I can find. Thanks.
So I figured out what was causing the issue. When using a Python IDE like Arduino Lab for MicroPython or Thonny, you need to make sure that you only create an RPC object once and that you only try to start the M4 process once. For example, regarding the M7 script provided here: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-dual-core/#micropython-rpc-led, you can't make changes in the editor and re-run the script because there is already an RPC object instantiated. However, if you modify the script as shown below, you can edit and re-run the script as many times as you like.
import time
import msgpackrpc
if not 'rpc' in globals():
# Create an RPC object
rpc = msgpackrpc.MsgPackRPC()
# Start the remote processor.
rpc.start(firmware=0x08180000)
# Toggle the LED every 500ms
while True:
rpc.call("led", True)
time.sleep_ms(500)
rpc.call("led", False)
time.sleep_ms(500)