Forum Discussion
Altera_Forum
Honored Contributor
18 years agoDE2-70 RS232 and VGA Question
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....13 Replies
- Altera_Forum
Honored Contributor
Thank you! Daixiwen.I have come up with the problem.
- Altera_Forum
Honored Contributor
Are you using the small c library? In that case you could be limited in the functions you can call.
- Altera_Forum
Honored Contributor
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! - Altera_Forum
Honored Contributor
Hello everyone!
- Altera_Forum
Honored Contributor
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! - Altera_Forum
Honored Contributor
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! - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
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.. - Altera_Forum
Honored Contributor
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. - Altera_Forum
Honored Contributor
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!