Forum Discussion
Altera_Forum
Honored Contributor
21 years agoSPI Example?
Hello Everyone, I'm working on a project that utilizes the SPI interface of the SOPC builder. I'm having some trouble getting it to work though, mostly because I'm not sure if I'...
Altera_Forum
Honored Contributor
20 years ago --- Quote Start --- originally posted by kedimike@Jan 25 2006, 08:23 AM leslie
i found that the function above has a problem,
void spi_tx_char(int tx_data, long spi_dac_addr)
for the parameter of " long spi_dac_addr" if i use it such as 0x008200,the programe can run ,but if i use it such as spi_0_base,the programe cann't run,why?
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=12383)
--- quote end ---
--- Quote End --- Probably because I seem to have pasted the wrong file. I will double-check on Monday to be sure that I pasted one where the subroutine is correct. SPI_0_BASE is the base address of an spi core named spi_0. Find out what you called yours in SOPC builder or look for the name of it in system.h. To transmit data of 0xaaaa out through spi_0: mydata = 0xaaaa; spi_tx_char(mydata, SPI_0_base); This is simplistic. It doesn't check for errors.