FPGA to MCU

Communication Protocols: SPI & I2S
Author

Victoria Parizot & Audrey Vo

Published

November 19, 2024

We ended up using mono audio, only sending out the left channel of the stereo data to the MCU for output due to problems with outputting audio. We originally had planned to configure the MCU Serial Audio Interface (SAI) peripheral to I2S. This would allow us to use standard audio interfacing, sending the left and right channel at the same time. While we got close to transmitting, the lack of examples and unclear documentation caused us to pivot to using an external DAC to output audio from the FPGA. We opted to use a UDA1334A I2S DAC. To test this DAC, we used the FPGA to generate clock signals, and hooked it up directly to the ADC for testing. Despite configuring how it requested in the datasheet, we could not get any signals coming out of the DAC. Finally, we opted to resort to SPI between the FPGA and MCU, allowing us to leverage the prexisting SPI transaction for the potentiometer values.

SPI Protocol

The MCU and FPGA pass data using SPI protocol, where it passes potentiometer values from the MCU to the FPGA and audio data from the FPGA to the MCU in 8-bit packages. The SPI handshake works with two flags, the Load Flag and the Done Flag. The Load Flag would be raised while the MCU was transmitting EQ values. The Done Flag would be raised once the FPGA was done reading in an audio sample and would be lowered after the FPGA transmitted the audio data to the MCU.