Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHello!
I'm have the same doubt... Im using the altera RS232 university program, and I use the functions described in the datasheet of the RS232 core. I was trying to send some data with nios 2 to the rs232... but I could't get any success yet. Here's the code: # include <stdio.h># include <system.h># include <string.h># include <stdlib.h># include <unistd.h># include "altera_up_avalon_rs232.h"; int main() { int c; printf("\033[2J"); //clean screen printf(" Start.\n"); alt_u8 data; unsigned int space; alt_u8 temp; alt_u8 RS232_dev; data = 2; //just some data to send... RS232_dev = alt_up_rs232_open_dev (RS232_NAME); space = alt_up_rs232_get_available_space_in_write_FIFO(RS232_dev); printf("%d\n", space); while (1) { temp = alt_up_rs232_write_data(RS232_dev, data); printf("%d", temp); //if temp is =0, the data was send... for(c=1; c<=100000; c++) //delay {} } return 0; } The function "alt_up_rs232_write_data" is returning "0", that means success... but I'm geting nothing through RS232, which I'm reading with a software (like Hyperterminal) in a computer. Link to the datasheet of the RS232 core: ftp://ftp.altera.com/up/pub/altera_material/11.1/university_program_ip_cores/communications/rs232.pdf Thanks!