ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can I make a program to transmit data out one serial port and recieve it through another using RS-232? I'm on ubuntu in case something's broken that I don't know about. I need to interface an FPGA to user software for a school project and I've never done anything like this before.
Do I use a null-modem cable? What libraries do I need for serial? Is the API part of the kernel? Can anyone recommend any guides?
If you're interested the project is for robotic simulations using player/stage. We'll be testing parallel processing algorithms on the FPGA to process environment data and control a virtual robot. I've chosen RS-232 for the relative programming simplicity over say USB as I've got a firm deadline to produce a demo (months away mind you but school takes up a lot of my time). In any case if this were possible I could learn serial communication and also have the software interface basically taken care of while I wait for the dev kit hardware.
Can I make a program to transmit data out one serial port and recieve it through another using RS-232? I'm on ubuntu in case something's broken that I don't know about. I need to interface an FPGA to user software for a school project and I've never done anything like this before.
Do I use a null-modem cable? What libraries do I need for serial? Is the API part of the kernel? Can anyone recommend any guides?
If you're interested the project is for robotic simulations using player/stage. We'll be testing parallel processing algorithms on the FPGA to process environment data and control a virtual robot. I've chosen RS-232 for the relative programming simplicity over say USB as I've got a firm deadline to produce a demo (months away mind you but school takes up a lot of my time). In any case if this were possible I could learn serial communication and also have the software interface basically taken care of while I wait for the dev kit hardware.
I'm no expert, but the most helpful guide I've found to Linux serial programming is this one:
This is for C programming, of course. I spent about an hour working with it and I was able to do basic serial configuration and read/write. It gives an explanation of the null-modem cable issue also.
With both ports on a single host, all you need are two conductors: each port's Tx pin connected to the other port's Rx pin. No ground necessary for a one-host system.
Some other good links, in addition to the very good one pointed out by CoderMan:
These links should give you everything you need, including some very good examples to get you started. I recommend starting with a couple of terminal emulator sessions, such as minicom or C-Kermit (my preferred tool), just to sort out the cabling, port names, etc. Then replace one end of the connection with some of your own code. Once you have the basic communications working, flesh out the project with your own software.
I would imagine he is writing code to communicate with some device, as well as creating a software simulator of that device. Each end of the system is a talker and a listener, and performs different functions, independently of the other. I have done this myself at times, and it worked very well as a first level of testing and debugging tool. Very useful when the target hardware is unavailable as a test & development platform.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.