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

**URL:** <https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373>\
**Category:** OpenMV Boards\
**Created:** [August 1, 2022, 9:15pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373 "2022-08-01T21:15:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![RB202](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@RB202](https://forums.openmv.io/u/RB202)\
**Post date:** [August 1, 2022, 9:15pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/1 "2022-08-01T21:15:44Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 1, 2022, 9:32pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/2 "2022-08-01T21:32:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RB202](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@RB202](https://forums.openmv.io/u/RB202)\
**Post date:** [August 2, 2022, 2:32am UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/3 "2022-08-02T02:32:50Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 2, 2022, 2:48am UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/4 "2022-08-02T02:48:53Z")

</div>

7.5 Mb/s

---

<div class="post-metadata">

**Author:** ![RB202](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@RB202](https://forums.openmv.io/u/RB202)\
**Post date:** [August 2, 2022, 3:07pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/5 "2022-08-02T15:07:38Z")

</div>

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.

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/f/f275b11bf89f324a82d16a1e2dbd1fa2f0195f03.png)

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

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 2, 2022, 4:52pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/6 "2022-08-02T16:52:30Z")

</div>

That gets defined here. [openmv-arduino-rpc/openmvrpc.h at master · openmv/openmv-arduino-rpc · GitHub](https://github.com/openmv/openmv-arduino-rpc/blob/master/src/openmvrpc.h#L392)

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.

---

<div class="post-metadata">

**Author:** ![RB202](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@RB202](https://forums.openmv.io/u/RB202)\
**Post date:** [August 2, 2022, 11:00pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/7 "2022-08-02T23:00:18Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/4/479b0941321d46e950cebc0919b22b40c2eb2994.png)

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

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/7/79ddc295a436443628a2ee5ff4d1d4b66e5ab2d6.png)

Maybe it is no longer “accurate”?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 4, 2022, 3:24am UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/8 "2022-08-04T03:24:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![RB202](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@RB202](https://forums.openmv.io/u/RB202)\
**Post date:** [August 4, 2022, 5:19am UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/9 "2022-08-04T05:19:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [August 6, 2022, 4:19pm UTC](https://forums.openmv.io/t/h7-plus-spi-seemed-to-disable-uart-comm-when-used-together-on-mkr-zero/7373/10 "2022-08-06T16:19:09Z")

</div>

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?
