- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am doing a project with NIOS II and I need to transfer data between my board and the PC through the RS232. I generated a NIOS II system with RS232 support. On my test, I can transfer data from the FPGA board to PC through RS232 by using the "IOWR_ALTERA_AVALON_UART_TXDATA" macro, but I can't write data into the FPGA board through RS232. My question is: If I want to write data into the FPGA board through RS232, do I need to setup the RS232's control register as "0x0080" (RRDY) before the writing? Or I just need to check the status register's value and write data when it is "0x0080". Even easiler, I just need to use the "IOWR_ALTERA_AVALON_UART_RXDATA" to write data directly without checking or setting the status of RS232. Actually, I've tried all of the three above methods but failed. Everytime when I tried to read the data that I wrote in by using the "IORD_ALTERA_AVALON_UART_RXDATA", the value is "0". Could anyone help me? Thanks.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey,
This is a function thats send one byte to the UART void UART1_T(unsigned char ch) { while((IORD_ALTERA_AVALON_UART_STATUS(UART1_BASE) & 0x040) != 0x040){ ;} IOWR_ALTERA_AVALON_UART_TXDATA(UART1_BASE,ch); } You only have to change UART1_BASE address to your UART address that you can find back in your system.h file Good luck Regards Karel- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Hi, I am doing a project with NIOS II and I need to transfer data between my board and the PC through the RS232. I generated a NIOS II system with RS232 support. On my test, I can transfer data from the FPGA board to PC through RS232 by using the "IOWR_ALTERA_AVALON_UART_TXDATA" macro, but I can't write data into the FPGA board through RS232. My question is: If I want to write data into the FPGA board through RS232, do I need to setup the RS232's control register as "0x0080" (RRDY) before the writing? Or I just need to check the status register's value and write data when it is "0x0080". Even easiler, I just need to use the "IOWR_ALTERA_AVALON_UART_RXDATA" to write data directly without checking or setting the status of RS232. Actually, I've tried all of the three above methods but failed. Everytime when I tried to read the data that I wrote in by using the "IORD_ALTERA_AVALON_UART_RXDATA", the value is "0". Could anyone help me? Thanks. --- Quote End --- char character; while(1) { alt_putstr("\nEnter character :\t"); character = alt_getchar(); alt_putstr("\nEchoed character :\t"); putchar(character); } //UART1_T(c); return 0;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. > Add RS232 in SOPC
2. > Open RS232 in Eclips "FILE *fp", fp = fopen("path of RS232 from system.h like /dev/....","rb+"); 3. > use fprintf(fp,"%d", --your data---); for writing on RS232 port
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