You are correct with your assumption.
The FPGA will be part of a device that performs specific tasks and will be remotely controlled via SPI form a different device.
So we implemented a SPI interface with the new Qsys and configured it to behave as a SPI Slave device.
I have taken a look in the guide before but I am afraid I need more guidance.
My specific Problem is this:
The FPGA will receive a Command String from another device telling it what to do.
I need to understand how I can activate the SPI interrupt in C, so that everytime a transmission is started the interrupt handler can do what I need it to do. I believe I need to register the interrupt or something and define the handler.
SO far I tried this:
Initialising:
void init_spi{
/* Enable SPI read-ready interrupt */
alt_irq_register(SPI_0_IRQ, (void*) &spi_context, handler_spi_isr);
}
handler:
static void slave_spi_isr(void* context, alt_u32 id)
{
printf("Works, yay!\n");
}
I put that in the Hello_World example and it compiles okay.
But an spi command send to the fpga does not trigger the
handler. What's weird though, when I did the same inside the
NIOS 2 Debugging enviroment, there was an error message
telling me "target faild to interrupt".
I am sorry, if my questions or my confusion seems stupid,
but I am more used to 8-bit architectures, where I can look
up the internal register structure of a given processors
hardware and where I know every Register by heart.