Tuesday, 30 December 2014

Serial Port connection between two machines in virtual box


On Host Machine or Machine 1:
  1. Create host pine with \\.\pine\com1
  2. Tick on create pipe (you have to power on this machine 1st as you are creating pipe here)

Machine->Setting->Serial Ports (Setting for Machine 1 or Host Machine)

On Test Machine or Machine 2:
  1. Create host pipe with same name \\.\pipe\com1
  2. We are using host pipe created by host machine so please don’t mark checked for create pipe here.

Machine->Setting->Serial Ports (Setting for Machine 2 or Test Machine)


Now you can power on both machine for testing serial port.


Some Useful commands :


[root@localhost ~]# dmesg | grep tty
console [tty0] enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:05: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
Information about serial port setting:

[root@localhost ~]# stty < /dev/ttyS0
speed 9600 baud; line = 0;
-brkint -imaxbel
[Baud rate must be same at both machine]

Test Connection:

On First machine:
[root@localhost ~]# echo hii > /dev/ttyS0

On second machine:
 [root@localhost ~]# cat /dev/ttyS0
hii

[ Note : Please run cat command first ]

No comments:

Post a Comment