Serial2 disabled when used with I2C sensors for OpenCM-904 in Arduino mode


Just found a strange problem with OpenCM-904 in Arduino mode:

  1. On the OpenCM-904, I can use Serial2 with BT-210 and connect it to the PC via TASK 2 Output Monitor as usual - similar to my project with the BT-210 and MKR ZERO. See posting below.
  1. Also SEPARATELY on the OpenCM-904, I can also successfully interface 3 ToFs sensors from Pololu to the usual I2C ports (D24 and D25) on the OpenCM-904:

However, I have found that I cannot use both features AT THE SAME TIME, because the I2C port/sensors somehow would disable access to Serial2. Only the I2C sensors worked properly in this situation, although in theory these are two independent Arduino services.

It is even more interesting that I found that the same issue is happening on my MKR ZERO, so I reported the same issue there

Has anyone encountered this issue? I would be very surprised to know that no one has tried to use BT via Serial2 and to interface an I2C sensor at the same time on the OpenCM-904 after all these years! So maybe I have missed something very fundamental some where?


Well…not really familiar with your case,

As the OpenCM 9.04 use hardware ports for I2C (D24, D25), I think it’s okay to use separately USART(A4,A5) and I2C (D24,D25).

if you are using wiring.h for I2C, this may implement software I2C (Found at here) which might be a cause. For Hardware I2C, use i2Cdev.h

The code was from Pololu and it used the following #include statements:
#include <Wire.h>
#include <VL53L1X.h> // Pololu Library

Isn’t “Wire.h” hardware I2C?

Via the conversations on the Arduino Forum, I have figured out the “problem”, see this post

But I don’t know if Pololu’s help/solution is forthcoming or not. I am going to try a BLE SPI module from Adafruit instead to see if I can work around this issue.


I had found a work-around using the BLE SPI module from Adafruit for my MKR ZERO, for more details see my Pololu post

Unfortunately, I had found the Adafruit BLE SPI not to be compatible with OpenCM-904, so I’ll be staying with DMS-80 sensors and BT-210/410 for my OpenCM-904 projects from now on.

Thanks to a tip from Pololu, I figured out a second way (a non-blocking way) that resolved all my issues on a MKR ZERO. See this post

This solution also worked on the OpenCM-904.

The main conclusion is that if ToF sensors such as Pololu VL53L1X are used with the OpenCM-904 in Arduino mode, they will have to be read in “non-blocking” mode, so that the Serial2 Port remains functional