Now to check for any USB to serial converter use dmesg | grep tty command. Now if you dont have any hardware serial ports ( like in my case ) the command will not print anything,like this. It means that ttyS0 is your hardware serial port connected to your computer. Now you can see a large number of serial ports listed in the /dev directory like ttyS28,ttyS23 etc.Now to identify which of the ttyS* corrosponds to your hardware serial port run the following command on the terminal. In Linux the hardware components like serial ports are treated like files and are grouped together in the /dev folder in the file system.if you navigate into the /dev folder and list the files using ls command you can see the files corresponding to various hardware devices. USB to Serial Converter based serial ports are usually named as ttyUSB* where * can be 1,2,3. etc.They are similar to COM1,COM2 etc under a windows box. Traditional hardware serial ports under Linux are named as ttyS* where * can be 1,2,3. Contact Us to Enquire about the full Source codes.Please note that the source codes on the website show only the relevant sections to highlight the process of programming the serial port.In this tutorial we are going to use the C language to program the serial port on a Linux Operating system(Ubuntu/LinuxMint).The compiler used is gcc which is freely available along with the OS. If you have traditional D subminiature (DB9) Serial Ports,just identify the relevant pins (RXD, TXD,RTS,DTR and Ground) and continue with the tutorial. You can use any FT232 based board ( other USB converter boards based on different chip sets should work,but i have not tested it ) or you can buy the one I am using here. Please note that in this tutorial I am using a USB to Serial Converter based on FT232 from FTDI. One problem with the traditional serial ports is that they are now legacy hardware and are being phased out by the PC manufacturers and most laptops have USB ports only,this problem can be easily solved by using a variety of USB to Serial Converters available in the market,eg USB2SERIAL V2.0. This is a tutorial on how to program the Serial Ports on your Linux box.Serial Ports are nice little interfaces on the PC which helps you to interface your embedded system projects using a minimum number of wires.In this tutorial we will write a small program that will send and receive ASCII characters to a microcontroller development board.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |