Forum Discussion
Altera_Forum
Honored Contributor
16 years agoNios2 SPI
Hi, I'm having some trouble reading from my IO expander with the SPI core from Altera :confused: Can anybody provide me with an example on how to issue a correct read to the spi inter...
Altera_Forum
Honored Contributor
15 years agoand how would that work without the standard command?
I'm an altera newbee and have the same problem. i need to send 7 bit reg-addr.+1bit r/w and 16 bit data I'm trying with
#include
<altera_avalon_spi_regs.h>
#include <altera_avalon_spi.h>
main{
int test;
while (!(IORD_ALTERA_AVALON_SPI_STATUS(SPI_BASE) & ALTERA_AVALON_SPI_STATUS_TRDY_MSK));
IOWR_ALTERA_AVALON_SPI_TXDATA(SPI_BASE, 0xFFFF);
while (!(IORD_ALTERA_AVALON_SPI_STATUS(SPI_BASE) & ALTERA_AVALON_SPI_STATUS_TRDY_MSK));
test=IORD_ALTERA_AVALON_SPI_RXDATA(SPI_BASE);
}
but the thinks i write dont match with the read data... :( Any help?