Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

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

Altera_Forum
Honored Contributor II
1,799 Views

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? 

 

Thanks.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,070 Views

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

0 Kudos
Reply