Teensy i2c and motor problems

I am troubleshooting a big weird problem on my robot. I am eliminating variable after variable to try and narrow it down.

I have a very short script for the teensy that drives two motors via a polulu motor control board. It also checks and lists the i2c devices detected. The script is for a teensy and I am uploading it using Platformio.

There are two robots, an older one and one that I am building now. Call them OLD and NEW. Both OLD and NEW have identical teensy 4.0, motor controller and motors. Both OLD and NEW have identical Raspberry Pi 4’s.

Running the same script on OLD produces the expected result. The motors move fast or slow based on the pwm I ask for in the code. They print out the name of the i2c devices.

Running that same script on NEW is unexpected. The i2c code is not detecting the i2c devices. And the motors turn, in the correct direction, except at one fixed speed (seems around 75%) no matter what the PWM.

We have replaced teensy, motor controller, cables, raspberry pis, and the problem persists.

My platformio specific question: can anyone imagine something having to do with how the program is compiled and uploaded, or some subtle version skew, or anything else, that would have those symptoms: i2c access is throwing errors (not simply not detecting i2c devices, but errors.) And motor can’t be controlled?

Try building your code with the Arduino IDE then to check if it’s a PlatformIO issue. Some people ran into “gotchas” here and this.

Thanks. I did try doing it with just teensyduino IDE, and the problem remains.

In the meanwhile (untold hours spent) we figured it out. Our motor driver board was the culprit. It looks and sounds the same as the one on the working robot, there is a subtle difference in the pins and how they work. So we are re-ordering those parts and hopefully we will be off to the races.