- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
I'm using uC/OS-II (version 2.77) on Nios II platform using Quartus 6.0, Service Pack 1. The SPI included provides a HAL interface that is pretty much limited to the alt_avalon_spi_command() function. This function does not give up control so other processes can run while waiting for transfers to complete. I have attempted to use the IRQ given to the SPI Bus device in system.h, but the interrupt never seems to fire even though data is being transferred. Do I have to do something other than the following? alt_irq_register( SPI_BUS_IF_IRQ, (void *)NULL, handle_spi_interrupts ); Thanks, Bob.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You also need to write the SPI controller's "control" register to enable the interrupt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. I forgot to mention that I am also doing this in my SPI access function:
IOWR_ALTERA_AVALON_SPI_CONTROL( SPI_BUS_IF_BASE, ALTERA_AVALON_SPI_CONTROL_SSO_MSK || ALTERA_AVALON_SPI_CONTROL_IRRDY_MSK ); The inclusion of the ALTERA_AVALON_SPI_CONTROL_IRRDY_MSK seems to make my code always read 0xFF from the RxData register. Thoughts?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Found the problem. I used logical OR (||) instead of bit-wise OR (|) in my IOWR_ALTERA_AVALON_SPI_CONTROL() call.
Thanks.
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