Altera_Forum
Honored Contributor
11 years agoNios as slave with spi
Hello guys, I'm writing beacause I need some suggestions..
I have an FPGA running a NIOS2 processor. This processor will be interrogated by a master peripheral with the SPI protocol. I know that it's possible to configure the SPI with a software interrupt. By the way I'm not sure about how configuring the SPI peripheral as slave. Actually I receive some strings with different lengths from the master system, than I have to extrapolate the informations contained in these strings, do some elaboration and finally send the answer message if needed (that are other strings with different lenghts). Sumnmarizing I need to read the string sent by the host then have enaugh time to elaborate the information and finally send the answer message. So I thought to enable the interrupt on the SPI and get the string from the master, when the string is received set a register to 0. Now the master must poll the register until goes to 1 before give me the clock necessary to have the answer message transmitted. How can I do the "register thing" ? There are better options ? [EDIT] One more thing.. I saw that the SPI has a fixed bitsize, so if I have to receive a string with a non fixed length how can I manage the SPI configuration ? I want to accomplish something like this https://www.alteraforum.com/forum/attachment.php?attachmentid=9300 in which the length of the bitstream is only defined by the edge of the SSN.