- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I have a NIOS2 design that requires real time data in and out via codec. I'll be processing one data point at a time. My code will read SPI for data ready, when ready - write data to SPI, then read returned data from SPI. I ran across the following code on the next thread over - it uses only IOWR and IORD functions, so it is simpler than the examples i've studied, but it's about the complexity i would hope for, for simple A/D/A to/from NIOS2. Does this code look OK as is? I guess i will need to add a 'reset data-ready flag' instruction, right? # include <altera_avalon_spi_regs.h># include <altera_avalon_spi.h> main{ int test; while (!(IORD_ALTERA_AVALON_SPI_STATUS(SPI_BASE) & ALTERA_AVALON_SPI_STATUS_TRDY_MSK)); IOWR_ALTERA_AVALON_SPI_TXDATA(SPI_BASE, 0xFFFF); test=IORD_ALTERA_AVALON_SPI_RXDATA(SPI_BASE); } To recap then - Is this all i need (in main C NIOS2) to poll, write, read? Any obvious things Missing? Thanks all,Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1. SPI Slave or Master configuration? The same code is been discussed on previous thread,You can refer links. http://www.alterawiki.com/wiki/spi_core https://alteraforum.com/forum/showthread.php?t=51485 Best Regards, Anand Raj Shankar (This message was posted on behalf of Intel Corporation)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page