Showing results for 
Search instead for 
Did you mean: 
Honored Contributor I

How to select which SPI slave to read/write thru alt_avalon_spi_command()?

I have a design using Altera IP SPI (3 wire serial). In this design, the SPI master connects with 3 slaves.  


The driver provided by Altera is:  


nt alt_avalon_spi_command(alt_u32 base, alt_u32 slave, 

alt_u32 write_length, const alt_u8 * write_data, 

alt_u32 read_length, alt_u8 * read_data, 

alt_u32 flags); 


Based on the document, the 2nd argument "alt_u32 slave" is used to "Asserts the slave select output for the specified slave". Does this mean, if I want to write/read slave 0, I should set slave = 0x00, if I want to r/w slave 1, slave = 0x01, or if I want to r/w slave 2, slave = 0x02. Is my understanding correct? 


0 Kudos
1 Reply
Honored Contributor I

unlike I2C, we can specify the slave number that we need to control from the signal you send in.. but in spi is different usage... the case is only can control with the SS_N before you send any data signal , you may add more SS from the qsys under the spi core window..