Forum Discussion
Altera_Forum
Honored Contributor
9 years agoIn general you have two options:
1. use PIOs and directly bit-bang them to drive spi wires 2. instantiate a SPI master core in your Qsys The nr.1 is generally used when you have a microcontroller without native spi interface and you don't bother about performance; but in your case the nr.2 is definitely more convenient, since on a FPGA the spi core comes for free. First of all you need to instantiate and configure the SPI core in your system. You'll find it in the standard set of Qsys interface devices. Then connect the Avalon slave port to your Nios data master and route the 4 exported spi wires to the fpga pins connected to your DAC. After you have build the Quartus project and configured the fpga, you simply use the HAL library functions to access the spi device, transmit and receive data.