Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

dev/uart_rs232

Hello!

I try to send data to the rs232 of the Nios Embedded Evaluation kit.

I used the SOPC Builder and used the SOPC files of the Nios II System Architect Design Tutorial. There I put in the uart-rs232.(9600 Baud one stop Bit) In the top level Design I put an input on the rxd_to_the_uart_rs232 (default value VCC) and an output on the txd_from_the_uart_rs232.

In Pin Setup I did this settings:

Node Name: Direction: Location: I/O Bank: VREF Group: I/OStandard:

rxd_to_the_uart_rs232 input IOBANK_8 8 - 2.5 V(default)

txd_from_the_uart_rs232 output IOBANK_8 8 - 2.5 V(default)

In Nios II IDE I compiled everything. The rs232 name: UART_RS232_NAME "/dev/uart_rs232"

The program to send data is this:

FILE *fp;

fp = fopen("/dev/uart_rs232", "w+"); // also used wb+, w+

if(fp){

printf("open succesful\n");

fwrite('a', sizeof('a'), 1, fp); // also used fwrite('a', strlen('a'), 1, fp);

fclose(fp);

}

else{

printf("Error writing rs232");

fclose(fp);

}

The file opens but I get no data out of the txd pin and I am sure I am using the right pin.

What am I doing wrong? Please help!!

15 Replies