Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

SPI through FPGA not working on Cyclone V SoC Terasic DE1SoC board

Honored Contributor II


I have connected the external SPI device through FPGA fabric to GPIO pins on the board. I'm using SPIM0 (0xFFF00000) I have created new preloader, uboot and linux distro, rbf and dtb file, etc..., everything that is needed i guess.  

Nevertheless none of the software is able to interface correctly with SPI devices (i.e. AD7791 and generic spidev device in linux). 

drivers give timeout exceptions on any write attempt. 


manually writing to SPI registers to trigger spi write gives nothing useful, the tx fifo is being filled with data, but nothing happens on output. 

for example:# devmem 0xfff00010 w 0xf# devmem 0xfff00010 w 0x0# devmem 0xfff00008 ; spi enabled 

0x00000001# devmem 0xfff00010 w 0x4# devmem 0xfff00060 w 234# devmem 0xfff00060 w 234# devmem 0xfff00060 w 234# devmem 0xfff00060 w 234# devmem 0xfff00060 w 234# devmem 0xfff00028 ; tx not empty 

0x00000002# devmem 0xfff00020 ; tx fifo fill level 5 

0x00000005# devmem 0xfff00060 



nothing changes on the pins, that I can scope. no CS toggling no CLK, no data etc. 

pin connection to hps is shown in attachment. 

pin localization assignments are correct. 


I have also checked that the PINMUX register for SPI to FPGA routing is correctly set:# devmem 0xffd08738 



any help would be appreciated! even the idea what to check i could forgot...
0 Kudos
1 Reply
Honored Contributor II

If you want more information on interfacing AD7791 to FPGA via NIOS, there's a design example here  

but its for a custom BeMicro kit. The point is you can get a fair idea on the interfacing and SW drivers from this example. This may help you setup your design or troubleshoot it.
0 Kudos