- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am just trying to see some activity out of the Avalon RS232 UART. I have instrumented my board's TX and RX lines on my 232 device ands am running the simple example below( Took from Software Handbook and then modified for just writes): I get the error at runtime: nios2-terminal: can't open uart: Permission denied Any tips or thoughts? Thanks. /* A simple program that recognizes the characters 't' and 'v' */# include <stdio.h># include <string.h># include "system.h" int main() { char* msg = "Detected the character 't'. \n"; FILE* fp; char prompt = 0; //fp = fopen ("/dev/uart_1", "r+"); // Open file for reading and writing fp = fopen ("/dev/uart_1", "w"); // Open file for reading and writing //print a message to console //printf(" I am starting UART Test \n "); fprintf(fp, "Open the UART \n"); //printf(" Should have written to UART .\n"); if(fp) { fprintf(fp, "%s",msg); fclose(fp); } /* if(fp) { while(prompt != 'v') { // Loop until we receive a 'v'. prompt = getc(fp); // Get a character from the UART if(prompt == 't') { // print a message if character is 't'. fwrite(msg, strlen(msg), 1, fp); } } fprintf(fp, "Closing the UART file. \n"); fclose (fp); } */ return 0; }Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Just an update to this problem. The nios2-terminal problem was due I believe to another session already open, hint I got from Altera. However, the simple HAL file example, where the UART is treated as a character device still does not work. I have double checked my connections,SOPC build, pin files, analyzer settings, trigger,etc, but I do not see any activity on the TX pin of the FPGA when I run my example( borrowed from Altera's software manual). Any thoughts on UART RS232 comm? Thanks.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
This turned out to be operator error. The code example above works fine on a custom board that we are developing. The HAL approach is very clean as opposed to setting up registers for the UART. Also, I am using the Bray terminal that I saw referenced here in the forum, it is much better than Hyperterminal! http://bray.velenje.cx/avr/terminal/ (http://bray.velenje.cx/avr/terminal/) -Baycool
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