Forum Discussion
Altera_Forum
Honored Contributor
13 years agoSPI with NIOS2 in qsys
Hi, I want to implement SPI in Qsys with one side NIOS 2. Well in SPI core of altera there is a function " int alt_avalon_spi_command(alt_u32 base, alt_u32 slave,alt_u32 write_length,c...
Altera_Forum
Honored Contributor
13 years agoHi,
Not quite sure what you're asking for, but the SPI functionality is pretty easy to use. An example read of two bytes: alt_avalon_spi_command (SPI_BASE, area, // Slave 2, // Number of bytes to write spi_buffer, // Buffer to write 0, // Number of bytes to read NULL, // Read buffer 0x00); // Flags The SPI_BASE comes from the system.h file and derives its name from whatever you called your SPI controller in Qsys. For example, if you called the SPI controller my_spi_0 the constant would be called MY_SPI_0_BASE. Mark.