- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm currently working on my Senior Project and I'm having many problems :mad: ... For starters I need to interface a CDMA Modem via Serial (RS232) and have the DE2-70 throw out AT commands that the Cell Modem can understand and send out the SMS message... I verified all the commands with HyperTerminal and everything works great... I just need to come up with some VHDL code that can talk to the RS232 port and send AT commands to the Modem... I am a complete n00b with VHDL, but I am familiar with Quartus software... If anyone can help get me started on some VHDL code for the RS232 port I would be most grateful... Later down the line I would like to display just the text comming off of the RS232 port to a VGA monitor... Again, not a clue where to start... I did some searching on this fourm, but haven't found an exact answer to my problem... Thanks in advance....Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can generate a system using SOPC builder; you can have system with NIOS II processor and simple UART core which can be interfaced to RS-232 port. And then you can easily write C program to process your data coming on RS-232 port. Also later on you can add one vga controller using video components available in newer version of SOPC builder.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Any chance you could post up some sample code to read the Rx data from the RS232port on the DE boards please? I have a DE1 and am having trouble reading the data. I am effectively trying to eavesdrop on an rs232 line. Cheers in advance, hiru- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can go through UART core documentation, from there you can get information on ready made APIs available with Altera UART core. Through API you can easily read or write data on UART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cheers for the promt response mate.
The SOPC component is fine, it is the actual software side in NIOS that I am having trouble writing. At the moment I have the pin for Rx going into the RS232 Uart on my NIOS processor. I only need to be able to read what communication is happening. If you could help me out with the code it would be extremely appreciated, I'm not all that great with programming. Also I haven't been able to find very much information... I'm possibly looking in the wrong place? I couldnt find any ready made API's... Thanks again!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this:
# include <stdio.h> # include <string.h> int main () { FILE* fp; char prompt = 0; fp = fopen ("/dev/uart1", "r+"); //Open file for reading and writing //replace 'uart1' with device name you have in sopc builder if (fp) { printf("UART Opened Successfully\n"); while (1) { printf("%c", getc(fp)); } } else { printf("Error: Could not open UART\n"); } return 0; } I have made it in quick time, so not sure if this returns any error, but you can modify it as you like. I have not used but you may want to add fclose(fp) to close UART properly at later stage.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cheers for the help! I tried it but i get the error below
-------------------------------------------------------------------------- **** Build of configuration Release for project hello_world_small_0 **** make -s all includes Linking hello_world_small_0.elf... obj/hello_world_small.o(.text+0x1c): In function `main': ../hello_world_small.c:28: undefined reference to `fopen' obj/hello_world_small.o(.text+0x38):../hello_world_small.c:33: undefined reference to `getc' collect2: ld returned 1 exit status make: *** [hello_world_small_0.elf] Error 1 Build completed in 30.842 seconds -------------------------------------------------------------------------- I spent a bit of time trying to figure out why it doesnt recognist 'fopen' but couldnt get to the bottom of it?? I'm guessing I must have missed a# include but i couldnt remember which (if any) relates to it.... essentially there are six variables being broadcast from a device to a computer and I am trying to eaves drop on this line to get those six variables into quartus. Hope that makes sense! So where should I go from here? Sorry for being such a noob..- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you can go to here http://www.alteraforum.com/forum/showthread.php?t=4903 where you find some Verilog HDL Code which allows you to use the RS232 interface.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Cheers mate! I came across that before but for some reason it wouldnt let me download the file. Got it this time tho!
I'll give that a go and let you know how it went. Thanks again! If there's any other tips/info please feel free to add it in the meantime!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any advice as how to turn that VHDL file into a block so i can add it to my bdf with my existing nios? also i only have a de1 board not a de2 board so i guess that vhdl file doesnt really apply; i'm guessing i just need to change the pin assignments?
is there any chance of anyone having an example project (or a link to one) which uses the rs232 with a nios processor? I am struggling and feeling rather helpless at the moment. I really need to get over this hurdle soon! I appreciate everyone's help!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone!
In Nios II, when I use getchar() function, I encounter with the problem :"undefined reference to getc".What's the problem? What should I do? I will appreciate very much with your help. Thanks!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the small c library? In that case you could be limited in the functions you can call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you! Daixiwen.I have come up with the problem.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page