- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do I get to communicate with the Nios II via serial pc?
Basically I would like nios II sends a string to the serial port. I use The Nios® II Software Build Tools (SBT) for eclipse.
I wrote the following code: # include<stdio.h> int main(){ printf("Hello world"); } and then I tried to change the standard input and output to UART1 standart but nothing is written to the serial. you could tell me some tutorials on the serial communication between the PC and nios II? thanks in advance for help
Link Copied
13 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First Add the RS232 on system using SOPC
Then Open RS232 Port on Eclips. then use std. fprintf for sending the data on RS232- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
kaushal's answer is right, you do it in according with his answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added the RS232 on system using SOPC.
How to open RS232 Port on eclipse? If I use jtaguart as stdin and stdout the code works but if I use RS232 don't work.... Thanks in advance for help- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- I added the RS232 on system using SOPC. How to open RS232 Port on eclipse? If I use jtaguart as stdin and stdout the code works but if I use RS232 don't work.... Thanks in advance for help --- Quote End --- write down below code in your main file. FILE *fp; fp = fopen("----copy past path of your RS232 file from system .h-----","rb"); if(fp==NULL) printf("\nFile /RS232 not open for writing...."); else fprintf(fp,"%d",---data (int)which you want to write on RS232---); fclose(fp);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you post what you did to solve the problem in case others have the same issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I solved it using the code posted by Kaushal. I was wrong path of my RS232 file from system .h ...
I opened the file system.h, and I put the right path. Note: if you use a serial sniffer like Hyperterminal you check that you have it set up correctly.. Sorry for my english but I am Italian if there are any problems please do not hesitate to ask. :D- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
fopen("/dev/uart/","w") returns NULL for me, do you know what could fix this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- fopen("/dev/uart/","w") returns NULL for me, do you know what could fix this? --- Quote End --- go to the system.h and find out the exact path for rs232 and then use that path for fopen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there.
I'm new with Nios SBT for Eclipse and I'm facing a problem with the rs232. Just like ermanno.tedeschi, I need to use the serial port but, despite I have added the RS232 on my system using SOPC, I cannot make the 'fopen' and the 'fclose' commands works... Does anybody has some tip/hint...something to tell me? Cheers- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
make sure you have add the correct header files ....for fopen and fclose
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi guy,
I figured out what was wrong with the project. Firstly, I setted up the wrong pins on quartus. Then, instead of using 'fopen' and 'fclose' commands, I used "IOWR_ALTERA_AVALON_UART_RXDATA(UART_0_BASE, (data-to-be-send))". It worked!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am Italian let me know what is your problem.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page