Forum Discussion
Altera_Forum
Honored Contributor
14 years agoSPI Problems
Hi, I'm trying to get handle with the SPI on a Nios II Core but I don't get it. I have a SPI master and a SPI Slave that I can try to transmit some data from the master to the slave. I connecte...
Altera_Forum
Honored Contributor
9 years agoHi siedler2011,
I'm facing the same problems that you've already faced. I'm implementing an SPI Slave Controller on my DE1-SOC Altera Board. My master is represented by a Microcontroller that should send data to DE1-SOC board. i'm obtaining the same values that you've obtained for the status register. "Statusregister of the Slave: 0x310". I'm using this code to implement the slave SPI Controller on my board: int main(void) { alt_u32 rddata=0x0; alt_u32 status; IOWR_ALTERA_AVALON_SPI_STATUS(SPI_BASE,0x0000); IOWR_ALTERA_AVALON_SPI_TXDATA(SPI_BASE,0x1001); IORD_ALTERA_AVALON_SPI_RXDATA(SPI_BASE); while(1) { do { status = IORD_ALTERA_AVALON_SPI_STATUS(SPI_BASE); } while((status & ALTERA_AVALON_SPI_STATUS_RRDY_MSK)==0 && (status & ALTERA_AVALON_SPI_STATUS_RRDY_MSK) == 0); rddata= IORD_ALTERA_AVALON_SPI_RXDATA(SPI_BASE); IOWR_ALTERA_AVALON_SPI_TXDATA(SPI_BASE, rddata); } Do you think it could work? I think i ve the same problems that you had with the SS_n signal. Could you help me ? Could you provide me code that you've used on your board set as SLAVE in the communication ? Thanks