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

Nios SPI and alt_u32 bit array

Honored Contributor I

Hello guys. I have a little doubt.. Hope someone could help me.. 


I'm using the standard altera function to tx and rx on a SPI. 


The proto is:  


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) 


So if i want to transmit the array:  

uint32_t my_array[32]={.....}; 


I would call: 

alt_avalon_spi_command(SPI_BASE, 0, 32, my_array, 0, NULL,0); 


By the way, as you see, the function alt_avalon_spi_command wants a 8-bit unsigned pointer. So how can I figure out if I want to transmit a 32bit unsignet variable at a time ? 


Intuitively I would do something like that: 

alt_avalon_spi_command(SPI_BASE, 0, 32*4, (uint8_t*)my_array, 0, NULL,0); 


What do you recommend ?
0 Kudos
0 Replies