Jackson White

Sensor Success!

Finally, after over a week of troubleshooting, I am able to communicate with the onboard sensors on the MatekH743! I have been attempting to read data from the onboard ICM42688 IMU. According to the Matek docs, the sensor is connected via SPI1. Since I know the board pinouts, it should've been a simple matter, just standard SPI communication using an STM32 board. However, it stumped me for over a week - everything I tried to do was fruitless. I messed with all sorts of different sensor protocols, scanning all SPI pins and registers, getting really deep into the ICM42688 documentation. You can learn more about all the different things I tried in the Daily Notes page, the entries from March 3 - 7.

At the end of the day, it was a ridiculously simple fix, and I can't believe it took me this long to figure out. When I defined a specific SPI bus in the code, the board wasn’t actually using that bus. Instead, it was defaulting to the GPIO bus.

This makes perfect sense because the board is primarily designed for consumer off-the-shelf applications, where users are expected to interface with external sensors over GPIO rather than accessing the onboard sensors directly. I should've realized this earlier, but I am a bit surprised I had to explicitly override things like this. I assumed that once I flashed the chip with my own firmware, the default SPI bus would be SPI1. But I've learned my lesson now, and that'll be good to know for when I communicate with the other onboard sensors, on other SPI buses.

The solution was a single line of code to explicitly override the default SPI bus selection and force communication over SPI1.

SPIClass spi1(SPI1_SDO_PIN, SPI1_SDI_PIN, SPI1_SCK_PIN, PNUM_NOT_DEFINED);

Once I did that, everything worked perfectly! I was able to get live data readings from the IMU! You can see the serial readings below.

ezgif

Next Steps: