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

programme for SPI interface

Altera_Forum
Honored Contributor II
965 Views

this is the programme that i use to interface SPI with shift register . i use Apex 20k200e .  

 

 

 

 

# include "excalibur.h" 

 

 

int main ( ) 

 

int i; 

 

int data_1 = 0x79; 

 

 

 

 

 

for (i = 0; i < 100 ; ++i) 

 

// Transmit a byte: 

while (!(na_spi->np_spistatus & np_spistatus_trdy_mask)); 

na_spi->np_spitxdata = data_1; 

 

 

 

// Read and throw away the received data: 

while (!(na_spi->np_spistatus & np_spistatus_rrdy_mask)); 

na_spi->np_spirxdata; 

 

 

 

 

//nr_delay(1000); 

 

// Wait until the last byte is transmitted: 

while (!(na_spi->np_spistatus & np_spistatus_tmt_mask)); 

// Release SS_n: 

na_spi-> np_spicontrol &=~np_spicontrol_sso_mask; 

 

 

 

 

 

 

but the problem is my shift register still no output. can anyone recomment me any comment about programme.
0 Kudos
0 Replies
Reply