Forum Discussion
Altera_Forum
Honored Contributor
14 years agoSPI read example
Hello, I need an example of the read transaction with the response. User Guide "Embedded Peripherals IP" has only write example. I tried the following transaction with no success:...
Altera_Forum
Honored Contributor
14 years agoHi sercher,
maybe I misunderstood but, are you trying to read from SPI without write on it? Remember that if the niosII is the master of the SPI transaction you have to write N bytes on the MOSI pin even if you wanna read N bytes. This because the slave is essentially a shift register and if you don't do this, it don't reply. Perhaps is this your problem? Try to use the alt_avalon_spi_command() function: this one first write X bytes and then read Y bytes (during this last operation it send 0 to the slave). I agree that if you have only to read, this is an oversized function, but it's a first step...