RPC library (remote / controller): power cycle or not power cycle?

I’m just getting started with the RPC library, and got the “image transfer as jpg” example running in no time.
I’m referring to these scripts:

rpc_image_transfer_jpg_as_the_controller_device.py (for the controler / host computer)

and

image_transfer_jpg_as_the_remote_device_for_your_computer.py (for the openMV camera)

BUT…

When trying the rpc_popular_features_as_the_controller_device_example.py (and the corresponding code for the camera), no matter what callback I select, I would always get an empty frame; and no jpg image was saved.
With the camera still connected, if I run again the jpg image transfer script (that is, copy the proper code on the camera and run the corresponding code on the computer), I could see the live image all-right. Switching back and forth between both examples only the jpg image transfer would show an image, the other example (popular_features …) would give nothing but empty frames.

After spending a long hour digging in the code, making sure I do save the proper code on the camera, adding debug lines in both the camera and computer codes, I thought I could try to unmount the camera (well, technically, its drive), and power cycle it.

Then, magic, everything worked with the rpc_popular_features_as_the_controller_device_example.py script.

So… why do I need to power cycle my board (tested was an H7 R1) in one case but not the other?
Is there another way to avoid a “hard” power cycle (unplug / plug the board)?

Hi, just a note, the USB transfer mode of these scripts to the PC is not 100% reliable all the time. The library was developed for SPI/I2C/UART/CAN comms between MCUs. It works extremely well when both processors are real-time.

When you introduce a non-real system the way the protocol works is degraded.

Anyway, I don’t think this is your issue here as either script would have not worked.

So, for your issue, the camera boots up and loads/runs whatever script is called main.py. Since these scripts take over the serial port on the camera you can’t use OpenMV IDE when they are running.

Anyway, so, the only way to change the script is to overwrite the script on the camera, and then reboot it so it runs the new one.

1 Like

Hi, actually my longish post was only to ask why do I need to power-cycle (unplug and re-plug) the board for one script and not the other.

I guess I will just follow your advice and reboot the board every time a new script (main.py) is uploaded or main.py is changed.

Thanks!