Altera_Forum
Honored Contributor
20 years agoHow to use
i m using alt_avalon_spi_command() now, and i did it according to Altera Embedded Peripherals Handbook chapter 7. I m looking using SPI to transfer some data to another board. And i can't figure out how to use this command line.
int alt_avalon_spi_command(alt_u32 base, alt_u32 slave, alt_u32 write_length, const alt_u8* wdata, alt_u32 read_length, alt_u8* read_data, alt_u32 flags) 1) Where can i find what value i should put for alt_u32 slave? 2) What value should i put for flag? 3) If i m going to just send the data, in MOSI mode, what value should i put for read_length and read_data? 4) do you have an example demostrating how to use this command ? I just can't get it to work on Nios II cyclone board. how is i wrote the code _______________________________________________________ /* alt_u8 sending[16] = { 0x81, 0xCF, 0x92, 0x86, 0xCC, 0xA4, 0xA0, 0x8F, 0x80, 0x84, 0x88, 0xE0, 0xF2, 0xC2, 0xB0, 0xB8 }; alt_u8 receiving[16]; download= alt_avalon_spi_command(0x00800000,1,16, sending,16, receiving,1); _______________________________________________________ and the output has no signal coming out. I can't figure out anything goes wrong.