Forum Discussion
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- Go through a NIOS II tutorial and create a "Hello World!" example. Have that example send data to a regular UART, and connect your FTDI interface to those pins. At that point you have a communications channel between your FPGA NIOS II processor, and your PC. Modify the NIOS II code so that it receives commands or data over the serial port, and then processes that data, eg., write to memory or read from memory. Write some MATLAB code to create and send the serial commands to the NIOS II processor, and then parse the response. Once you have the ability to write and read FPGA memory from MATLAB, you can then modify your FPGA code to add custom logic, eg., an FFT, and then you can send data to memory, program a DMA controller to stream it to the FFT, and stream the result back to memory, and once the FFT completes, you can read the destination memory from MATLAB and compare the result to the FFT model. Cheers, Dave --- Quote End --- Forgive me for another question, this is the code from the manual, what I dont understand is how by running this example the code can read the data from uart since it defines the strings here (char *str = "Hello from NIOS II\n" ) but not reading directly from uart? I could not find how to read and write from/to uart. # include <stdint.h># include "system.h" int main(void) { volatile uint32_t *uart = (volatile uint32_t*) UART_BASE; char *str = "Hello from NIOS II\n"; while (1) { char *ptr = str; while (*ptr != '\0') { while ((uart[2] & (1<<6)) == 0); uart[1] = *ptr; ptr++; } } return 0; }