Forum Discussion
Altera_Forum
Honored Contributor
10 years agoconnecting 4 GPIO pins to DAC using SPI interface
Hi. I am new to altera and am interested in connecting a DAC via the GPIO pins on my development board. the DAC takes a data connection using the spi interface so I am wondering what is the best ...
Altera_Forum
Honored Contributor
10 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.