SPI OpenMV RT1062 and nrf9160 (Zephyr RTOS)

Hey all,

I need to communicate over SPI between the OpenMV RT1062 and a nrf9160 running the Zephyr RTOS. As I see it there are the following alternatives available:

  1. Porting the RPC arduino library into Zephyr
  2. RT1062 as slave, nrf as master
  3. RT1062 as master, nrf as slave

The way I see it, alternative 3 is the only viable option since:

  1. Even though C++ applications can be supported in Zephyr, the RPC depends on the arduino core which is a whole other ball game to enable in the Zephyr firmware.
  2. Since the RT1062 can’t use the pyb library (as it’s only available for stm32 boards), the machine version of SPI only supports master setup.

I know that the OpenMV team recommends using the RPC library for inter MCU communication, but since it’s not available as a simple port for Zephyr based boards I don’t see myself using it. I am also aware that I need to develop my own SPI communication handling because of this and that I’m on my own for that.

I’m simply posting this to see if anyone else has any experience in the matter (RPC porting to Zephyr) and/or if the OpenMV team agrees/disagrees with my claim that only alternative 3 above is the most viable approach.

Thanks for any input on the matter.


Can you use a UART? It’s just going to be a much better experience. SPI/I2C are not good to use for processor to processor communication. They make more sense for a processor to a sensor.

Regarding our RPC library.

Just like modify the code. We use extremely little of the Arduino Core. It will take you less time than researching this than to just modify the library to work on Zephr.

Thank you for your reply!

I prefer to use SPI as I need to do bi-directional large file transfer and want to limit power usage during the transfer, this means that I want the speed of SPI. The two processors will be on the same pcb, so I’m not that worried about distance limitation of SPI.

Is there another limitation that you have in mind?

That’s great feedback, I’ll look into it a bit more. I saw that you included the arduino library and went straight to the forum. Have you heard of anyone using the RPC library on a Zephyr device?

Sure, I understand. Um, so unless you are transferring RAW uncompressed images, you don’t need SPI. The UART will be fine. If you are sending the complete byte array of the image then SPI makes the most sense.

Anyway, you just have to modify this amount of code for SPI in the interface library:

openmv-arduino-rpc/src/openmvrpc.cpp at master · openmv/openmv-arduino-rpc (github.com)

It’s literally just one function call.

As for this question:

Have you heard of anyone using the RPC library on a Zephyr device?

No, but again, it’s very easy to modify the interface library to use Zephyr. You just need to implement that function.

And you also have to modify this: openmv-arduino-rpc/src/openmvrpc.h at master · openmv/openmv-arduino-rpc (github.com)

The easist thing to do is just to create a SPI class that looks like the Arduino SPI class. Same for it’s pin control. Then you are good to go.

Cool, I appreciate the input a lot!

I’ll get to it.