Forum Discussion
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- I got data from fpga to my Nios processor where I can display the values on the Terminal window in Altera Monitor Program --- Quote End --- I have not used that tool. If it uses the JTAG-UART, then its probably not that easy to write custom software for it. Others might be able to comment. --- Quote Start --- I am thinking that I can save these data in sdram or a file and plot these data directly from Nios in pc, why do I still need the uart? --- Quote End --- Why think - just do it. Chances are that in the process of trying to do it, you find you cannot. That is why I recommended using a UART, since I know interfacing to that is trivial. You can access a UART directly from MATLAB. --- Quote Start --- i just want to plot graph to Matlab, does it mean I just need txdata but not rxdata? --- Quote End --- You'll need both. Ignore the fact that you are talking to an FPGA for a minute, and consider that you are trying to communicate between two processors; your MATLAB program is one process, and your NIOS II process is another. If you were to try to connect two PCs and have two instances of MATLAB communicate, how would you do that? First you would define a protocol, eg., lets say the protocol was to read and write data, with the read command being the string "r <address> <length>", and the write command being "w <address> <length> <data>", where address, length, and data are hexadecimal strings. Once you have that working, you can write a MATLAB script to communicate with the NIOS II processor, which in turn accesses the FPGA memory. --- Quote Start --- The third question is, i have created uart component in Qsys, I also have Matlab coding to plot graph, but I guess I need a bridge to interconnect these two, does it have to do with iord_altera_avalon_uart_rxdata(uart_base)? Could you please link me to an example that use this command (iord_altera_avalon_uart_rxdata(uart_base))? --- Quote End --- Sorry, I don't use NIOS II, but its "just a serial port", so work on it until you understand it. Those commands look very low-level. You should be working at a higher-level, i.e., with the C stdio library functions, but that assumes the NIOS II support library provides the hooks (stubs) to connect to the stdio functions. --- Quote Start --- I could not find how to read and write from/to uart --- Quote End --- You'll have to read the Altera documentation. The fact that the interface is a UART should be "hidden" from you. The interface should be the C/C++ stdio interface, or a file descriptor to the serial port. I can't really help with your NIOS II coding questions, you're better off asking a new question on the forum. Though these questions are fairly fundamental to using an embedded processor, and should be answered in Altera's documentation. So please take the time to read Altera's documentation, and run a "Hello World!" example - where you should see they use printf() not some UART command. Cheers, Dave