Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12408 Discussions

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

Honored Contributor I

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..