Hello!
I’m trying to send data from OpenMV H7 to stm32 controller. OpenMV acts like slave and it is absolutely crusial. I’m using hardware SPI. First package after SPI initialization sends correctly, but than SPI won’t send anything, so I need to reinitialize it every main cycle iteration.
Is it possible to send several packages without reinitializing SPI? How can I do it?
I don’t want to use any additional libraries.
Code that I tried at first (sends only one package):
Hello!
I don’t want to use any additional libraries because I need pretty simple form of communication. I believe I can achieve this using only basic functional. Also with RPC I’ll need to write whole library for stm32 by myself wich will take only more time.
Can you explain what might be the problem and how could I solve it?
See how the RPC library handles SPI communication. You need to sync the two board which requires the use of waiting on the CS pin to go low.
In your current code there’s no byte alignment. So, what you read could be anything shifted in time.
Given you don’t want to use the RPC library then you are on your own. We wrote the library after endless people trying to get drivers for comms working and having endless issues setting up the transaction because it is not easy. It’s not even a MicroPython or OpenMV thing. In general getting two processors to sync over SPI is hard.
I am confused on how to use rpc between a Raspberry Pi and OpenMV camera. Am suppose to install rpc.py on the Pi? It causes problems when I do (umachine, omv not found)
There’s a separate version of the library that runs in the desktop. See the tools directory in the main GitHub repo.
However, I recommend only using the RPC library for UART/SPI/CAN/I2C comms. It’s depends on a tight synchronization between both devices which application processors can’t necessarily meet.
I recommend using the MicroPython pyboard.py script to control the camera or our specialized debug controller scripts in our tools directory. You can send scripts to the camera to run via these scripts and then get print results back.
Hi, you’ll need to create a SPI interface. Per the documentation this isn’t particularly hard to do. You just have to implement a Python RPS master or slave class.
You can find an example for the UART via pyserial already in that file.