H7 Plus (SPI) seemed to disable UART comm when used together on MKR ZERO

Dear OpenMV Support,

I am using the H7 Plus camera (set to use SPI) on an Arduino MKR ZERO and on a MKR ZERO variant. For my project, I am using a modification of the Color Detection codes on the camera and on the Arduino boards. For my project, I am combining standard Remote Control via a BT receiver hooked to a UART/SERCOM Port on the MKR boards, and Autonomous Color Tracking using the H7 Plus.

On these boards, in setup(), I tested the camera by accessing the camera (RPC call) with a FOR Loop (10 times) to assure myself that the camera is tracking OK. And this part worked fine.

Next, in loop(), the robot is set first in RC mode, and I can see that my RC commands were coming through fine through my BT/UART connection.

Among the RC commands programmed in my code, there is one command that would trigger the Autonomous Tracking mode (in addition to the RC mode). If I activated this command, I could confirm that the H7 Plus camera was making the robot track a moving target fine. However, then my RC commands did not seem to go through anymore via that BT/UART port. It seemed that using RPC calls somehow disable or ignore all my UART communications traffic? Can you give me some directions for what to troubleshoot for?

I did a similar project using the Pixy2 camera via SPI also, and this camera did not disable my UART com port.

Thank you very much for any help!

Our RPC library isn’t threaded so when it does a SPI access to the camera it waits for the camera to return the result. So, there might be some blocking going on.

Hmm, it’s not really possible to put the camera into stream mode with SPI. As the camera will wait on you to do a SPI transaction before moving forward.

Do you have another UART? This would be the best. Then you can put the camera into stream mode using RPC and just have it send color tracking results continuously to your Arduino. This gives the best performance. The link will also automatically self-heal if you program it according to the examples. E.g. automatically re-connect if the link goes down and then is reconnected.

Thank you for the prompt response.

My Arduino boards have 3 more UART connections that can be set up, so I will try to put the H7 Plus onto an UART connection, and we’ll see. How high a baud rate is it possible to use with the H7 Plus? 2 Mbps?

7.5 Mb/s

Thanks for the info.

When I tried to use UART via my hardware Serial3 on my Arduino board, I got a compile error as shown below.

It looks like that I’ll have to fix the OpenMV source code somewhere?

That gets defined here. openmv-arduino-rpc/openmvrpc.h at master · openmv/openmv-arduino-rpc · GitHub

So, yeah… probably one of the defines needed to create the object is missing in your Arduino headers.

You’ll need to go look into where they put the SDK for their stuff and then find the file called variants. This defines all the port names.

Unfortunately, Arduino didn’t really standardize any of this so it’s really hard to support all the boards.

I’d prefer not to have the wrap the serial interface directly like I’m doing now. But, this is the only way with how the Arduino library is setup.

The link you posted is a link to your file openmvrpc.h and I found it (see pic below):

It looks like that I’ll have to fix Lines 419 and 441 from parameter name RPC_HARDWARE_SERIAL_UART_MASTER to RPC_HARDWARE_SERIAL3_UART_MASTER ?

Or is it to just define SERIAL_HOWMANY to 3 in my own Arduino code, and keep on using just plain RPC_HARDWARE_SERIAL_UART_MASTER?

Below is a screen capture of the relevant code in your provided example popular_features_as_the_controller_device_example.ino - so I am just trying to implement the information shown there

Maybe it is no longer “accurate”?

There’s no way to detect all the serial interfaces on an Arduino board and their names except through defines.

So, my code is trying to do that. However, the names of what the interfaces are aren’t standardized. So, it’s not easy.

You need to look at your variants.h file and see what it is defining and then adjust the interfaces to be compatible with that.

I already did check at my variants file, and I know that my board has already the right Hardware Serial defined as Serial3 and I already used the right GPIO pins (and checked it out using other UART devices). So I am not sure what you are trying to tell me here.

I already tried the option of setting SERIAL_HOWMANY to 3 in my own Arduino code, keep on using just plain RPC_HARDWARE_SERIAL_UART_MASTER and this option did compile OK, but run-time wise at the first capture command, it looked like nothing came back.

I did another option whereas I dropped to QVGA resolution while using SPI again, and that was a little better as if I kept pushing my “reset” key for 2-3 seconds, somehow my UART data stream finally got through the SPI’s block and turn off my Autonomous mode.

I am to try the I2C option next I guess!

Wait, if you got it compile then the library is fine at that point.

Your looking at an application problem then now. What are you trying to do?

I did another option whereas I dropped to QVGA resolution while using SPI again, and that was a little better as if I kept pushing my “reset” key for 2-3 seconds, somehow my UART data stream finally got through the SPI’s block and turn off my Autonomous mode.

What is using SPI? You said the link was via a UART?