Firmware Update and Mojo V2

Justin Rajewski

Mojo V2 is now Arduino Compatible!

We have added Arduino compatibility for the Mojo V2! We now have a slightly modified bootloader and support with our Arduino IDE plugin for version 1.6.x of their IDE. To get started, you will need to install the Arduino IDE and our plugin then flash the new bootloader.

We are very excited about this since it allows us to fully support the Mojo V2 and all our original Kickstarter backers with our upcoming projects. Keep in mind that some Mojo V2's were made with ATmega32U4 microcontrollers instead of the ATmega16U4 due to a stock shortage. If your Mojo V2 has an ATmega32U4, you should treat it like a Mojo V3 (they are electrically the same).

The only limitation of the ATmega16U4, is a lower maximum USB transfer speeds due to it having less RAM = smaller buffers.

New Firmware All Around

We have also made some modifications to both the AVR firmware and the Mojo Base Project for the Mojo V2 and V3. These modifications address the issue where sometimes some bytes would be dropped if you tried to send serial data as fast as possible. The new avr_interface module works exactly the same as before, so it should be a drop in replacement for your projects.

The old interface between the AVR and FPGA for sending serial data used a signal ( avr_rx_busy) for signaling that the buffer in the AVR was full and new data should not be sent. However, this was inadequate to prevent lost data. Each time a new byte is received, an interrupt is fired in the AVR that stores the data into a buffer to be later sent over USB. The problem occurs when two bytes are received before the interrupt handler has time to process the first one. In this case, the first byte will be lost. This happens when the AVR gets busy sending data over USB which has interrupts of its own preventing the bytes being processed in a timely manner.

The solution was to use the same avr_rx_busy signal, but instead of simply signaling when the buffer was full or not, to instead toggle each time a byte has been processed. This allows the FPGA to wait for the byte to actually be processed preventing any lost data.

With this new interface, you should enjoy reliable transfers with speeds around 48K bytes per second of one way transfer (tested as FPGA->PC) with the ADC disabled and 17K bytes per second with the ADC running constantly.