Hi,
I've tried to use DMA Controller without FIFO to read 10Bytes from On-chip Memory and write them on SPI Controller.
The SPI Controller hasn't flow control (in spite of on the datahseet it seems it has it) hence the DMA Controller continues to wirte Byte toward the SPI Controller without to wait the actual transmisson of the Byte on the MOSI output (the DMA writes Byte continuously). For this, the system is not good for my purpose.
Then I used another Nios processor and a FIFO to handle the communication: the main Nios processor writes into the FIFO and the second Nios processor as soon sees a Byte in FIFO and the TRDY flag is 1 (the SPI Controller tx register is ready to accept another data), it retrieves the Byte and transmits it toward the SPI Controller.
The second Nios processor has a main() function very simple, without interrupts: basically it checks if the FIFO contains data and if the TRDY flag is 1 and if so, it retrieves the byte and transmits it toward the SPI Controller tx register.
Viceversa, when the SPI receives something, it rises the RRDY flag to 1 and the second processor read the rxdata register of the SPI Controller and put the Byte in the same FIFO (the same FIFO because my communication is half duplex, if you want a full duplex communication you have to use 2 FIFO for the SPI, one for TX and one for RX).
In this way the main processor has to write/read to/from the FIFO only and the second processor polls the FIFO/SPI Controller, that is it reads from FIFO and writes to SPI Controller or viceversa.
This second processor could be used even to do same things with I2C or UART.
It could be a Nios/e (economy) processor if the datarate of your communication is not too high (1Mbps) because the Nios/e uses 6 clock cycles for instruction. Otherwise you have to use a Nios/f processor. For example i use the latter processor because my SPI comunication is at 10Mbps.
This is my solution. If anyone has one better, please tell it me.
Bye.