Skip to content

Alog

MPU6050 on an ULX3S using verilog

The MPU-6050 is a venerable but still very useful 6-DoF MEMS Gyro and Accelerometer.

It interfaces over I2C, commonly used with a microcontroller or a linux system.

I wanted to use it with my 1 yo ULX3S, and found a nice published VHDL project that I translated to verilog and built using the yosys+nextpnr toolchain.

The result is workable. The code is not easy to hack but is interesting to me as a neophyte veriloger: it is built as a single module, with a huge switch based on a single counter, so you can see explicitly the toggling of the SCL (clock, I2C is a master clock driven interface) and the SDA, data, lines.

Sources: git repo, original VHDL by Daniel Moran.

It actually worked fine with 25 MHz, I did not check what the rate is, just a very basic ax -> leds. Great things are planned for this, wishing for a smile from the god of side projects.

GTKWave of SCL and SDA

To produce the above image, build:

make wave