I have a Lattice Machxo3 FPGA based design / board and currently I am configuring the FPGA using JTAG. As per the datasheet I2C also can used as the FPGA configuration interface. Is it possible to use the I2C as the primary interface to configure instead of JTAG? The datasheet mentions that I2C can be used for reconfiguration. I just want to confirm.

Also, is there any same code available wishbone interfacing to configure FPGA?


1 Answer 1


Yes it is possible to use I2C for configuration. Almost all of my project are using the I2C interface only because of the reduced required pin count. Drawback is that one has to be more careful to not brick a device because recovery can be impossible without the JTAG interface.

required steps:

  • making sure that I2C is enabled in the Feature Row Editor
  • setup the EBR block (e.g. via IPExpress)
  • instance the EBR block in your design and make sure to route a proper clk to it (I recommend to use the internal oscilator OSCH)
  • connect a I2C "master" to your device (make sure to have pull ups for SDA and SCL in place. Typically I use a FT2232H mini module, which is recognized by the lattice diamond programmer as regular programmer)
  • setup programmer software to verify the device code via I2C to check for proper connection
  • setup programmer software to write feature row via I2C with 10000(00) as address
  • setup programmer software to verify the device code via I2C to check if the device is still responsive
  • now one can set the regular I2C erase, write, verify mode for programming

Additionally I recommend to assign individual I2C addresses for every pinout / board vision. Else it can happen that one program a device which an bitstream which is not pin compatible. This is especially a thing if you route some of the connections over other pins (which I frequently do to avoid the way more expensive via-in-pad technology).

Using the I2C interface not only for configuration but actively as interface is a different beast imho. I have some code for purely receiving mode via the wishbone EBR interface that can be extended to support writing as well which I might add later if there is any interest.

P.S. a few additional information can be found here: http://buildingelectronics.blogspot.com/2017/09/machxo3lf-tips-tricks.html

P.P.S: avoid to connect any outputs to the system pins as this might hinder the programming of a blank device via I2C. E.g. do not drive the SN pin with an external circuit as this might enable the SPI interface blocking of the I2C interface.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.