How to read/write data from RS-232 port

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
11 postsPage 1 of 1
11 postsPage 1 of 1

How to read/write data from RS-232 port

Post by robobuilder » Sun Oct 04, 2009 2:00 pm

Post by robobuilder
Sun Oct 04, 2009 2:00 pm

Hi,

I am new to this expansion board. Is it possible to read/write data from the RS-232 port? If yes, could you give me some sample code or example to explain that.

Thanks in advance for your help.
Hi,

I am new to this expansion board. Is it possible to read/write data from the RS-232 port? If yes, could you give me some sample code or example to explain that.

Thanks in advance for your help.
robobuilder offline
Newbie
Newbie
Posts: 3
Joined: Sun Oct 04, 2009 1:57 pm

Post by PedroR » Tue Oct 06, 2009 12:42 pm

Post by PedroR
Tue Oct 06, 2009 12:42 pm

Hi

The COMM port on the board is a standard COMM port so you read and write to it using the normal ways in windows:
For testing/debugging you can use Hyperterminal to write and read from it and for production you can use Visual Studio for example, and open the COMM port using the normal instructions.

From your nickname I would suspect you may be wanting to use it with a Robobuilder and, in that case, if you maintain the main RBC controller box you use COM1.
However if you want to replace the RBC controller box and talk directly to the servos, you need to use COM3 which is at TTL level. The servos have a UART at TTL level and not at RS232 level. If you connect the servos to comm1 you will most likely damage the board and/or the servos.

To read and write to COM3 it is the same procedure as COM1.

If you're not familiar with the difference between the levels at RS232 and TTL level I suggest you look it up in google.

Pedro.
Hi

The COMM port on the board is a standard COMM port so you read and write to it using the normal ways in windows:
For testing/debugging you can use Hyperterminal to write and read from it and for production you can use Visual Studio for example, and open the COMM port using the normal instructions.

From your nickname I would suspect you may be wanting to use it with a Robobuilder and, in that case, if you maintain the main RBC controller box you use COM1.
However if you want to replace the RBC controller box and talk directly to the servos, you need to use COM3 which is at TTL level. The servos have a UART at TTL level and not at RS232 level. If you connect the servos to comm1 you will most likely damage the board and/or the servos.

To read and write to COM3 it is the same procedure as COM1.

If you're not familiar with the difference between the levels at RS232 and TTL level I suggest you look it up in google.

Pedro.
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

Post by robobuilder » Tue Oct 06, 2009 4:47 pm

Post by robobuilder
Tue Oct 06, 2009 4:47 pm

Hi Pedro,

Thanks for your help. Actually I am planning to use this board with bioloid robot. I am trying to send data to CM-5 serial port from the x-86 board instead of PC. So, it can be controlled from the board. I think the procedure will still remain same(COM 1) as you mentioned in your post.
Hi Pedro,

Thanks for your help. Actually I am planning to use this board with bioloid robot. I am trying to send data to CM-5 serial port from the x-86 board instead of PC. So, it can be controlled from the board. I think the procedure will still remain same(COM 1) as you mentioned in your post.
robobuilder offline
Newbie
Newbie
Posts: 3
Joined: Sun Oct 04, 2009 1:57 pm

Post by PedroR » Tue Oct 06, 2009 5:37 pm

Post by PedroR
Tue Oct 06, 2009 5:37 pm

Hi robobuilder

Yes, the procedure is still using COM1.
You can actually install windows on the Roboard and run the Robot Terminal to test everything or at a later stage write your own custom programs.

Bear in mind that, if you plan to keep the CM5 you should be OK.

However if you intend to remove the CM5 controller and replace it completely with this board, you may need to take some additional steps.

Pedro.
Hi robobuilder

Yes, the procedure is still using COM1.
You can actually install windows on the Roboard and run the Robot Terminal to test everything or at a later stage write your own custom programs.

Bear in mind that, if you plan to keep the CM5 you should be OK.

However if you intend to remove the CM5 controller and replace it completely with this board, you may need to take some additional steps.

Pedro.
PedroR offline
Savvy Roboteer
Savvy Roboteer
Posts: 1199
Joined: Mon Jun 16, 2008 11:07 pm

COM port voltage levels!

Post by Marsman » Sun Oct 18, 2009 9:35 am

Post by Marsman
Sun Oct 18, 2009 9:35 am

It took me some time to actually "talk" to my RoBoard via the COM1 port. The issue was that my laptop runs the RS232 interface on 12V while the RoBoard runs on 3.3V. So one needs a level shifter between the null-modem cable. I finally used a USB-to-Serial adapter (http://www.prolific.com.tw/eng/Products.asp?ID=88).

In the BIOS one can enable output of all messages to the COM port and with a HyperTerminal I now can watch my RoBoard boot the Linux until the console appears on my HyperTerminal. Now I just need to finish configuring the WLAN card so that I can login even remotely.
It took me some time to actually "talk" to my RoBoard via the COM1 port. The issue was that my laptop runs the RS232 interface on 12V while the RoBoard runs on 3.3V. So one needs a level shifter between the null-modem cable. I finally used a USB-to-Serial adapter (http://www.prolific.com.tw/eng/Products.asp?ID=88).

In the BIOS one can enable output of all messages to the COM port and with a HyperTerminal I now can watch my RoBoard boot the Linux until the console appears on my HyperTerminal. Now I just need to finish configuring the WLAN card so that I can login even remotely.
Marsman offline
Robot Builder
Robot Builder
Posts: 13
Joined: Sun Sep 27, 2009 9:47 am

Post by snest » Wed Jul 28, 2010 9:33 pm

Post by snest
Wed Jul 28, 2010 9:33 pm

Hey guys,
I am also trying to communicate with my roboard via com1 port. I can see and modify bios via hyperterminal, but once it reports that the booting process has started, I am left with a blinking cursor. How do I actually use linux through the com port? How can I log in / install drivers for the mini pci wireless card / open terminal?

Thanks for your help in advance!
Hey guys,
I am also trying to communicate with my roboard via com1 port. I can see and modify bios via hyperterminal, but once it reports that the booting process has started, I am left with a blinking cursor. How do I actually use linux through the com port? How can I log in / install drivers for the mini pci wireless card / open terminal?

Thanks for your help in advance!
snest offline
Robot Builder
Robot Builder
Posts: 20
Joined: Thu Jul 22, 2010 10:00 pm

Post by matt.stevenson » Wed Jul 28, 2010 11:25 pm

Post by matt.stevenson
Wed Jul 28, 2010 11:25 pm

Hi snest,

I'm glad to hear you've got things running now.

I'm running Debian on the RB-100, but I doubt things are too different.
For serial communication you need to do 2 things.
First you need to edit you /etc/inittab to allow serial port login.
I have mine set to automatically log me in. Just add this line to the bottom of the file:

Code: Select all
T0:23:respawn:/bin/login -f you_username ttyS0 115200 vt100 </dev> /dev/ttyS0 2>&1


Edit: Ok this is pissing me off. in the "<" ">" brackets it should be "<"/dev/ttyS0 ">" not </dev> but the forum won't let me post that ... O_o

Second you need to edit /boot/grub/menu.lst to redirect the console to serial

Find the line for the kernel you boot into and add "console=ttyS0,115200n8" to the end. Mine looks like this:
Code: Select all
kernel  /boot/vmlinuz-2.6.30-vortex86dx root=/dev/hda1 ro console=ttyS0,115200n8


You can edit the grub menu on boot up before changing it, just to make sure everything works fine.

115200 is the baud rate I'm using
Hi snest,

I'm glad to hear you've got things running now.

I'm running Debian on the RB-100, but I doubt things are too different.
For serial communication you need to do 2 things.
First you need to edit you /etc/inittab to allow serial port login.
I have mine set to automatically log me in. Just add this line to the bottom of the file:

Code: Select all
T0:23:respawn:/bin/login -f you_username ttyS0 115200 vt100 </dev> /dev/ttyS0 2>&1


Edit: Ok this is pissing me off. in the "<" ">" brackets it should be "<"/dev/ttyS0 ">" not </dev> but the forum won't let me post that ... O_o

Second you need to edit /boot/grub/menu.lst to redirect the console to serial

Find the line for the kernel you boot into and add "console=ttyS0,115200n8" to the end. Mine looks like this:
Code: Select all
kernel  /boot/vmlinuz-2.6.30-vortex86dx root=/dev/hda1 ro console=ttyS0,115200n8


You can edit the grub menu on boot up before changing it, just to make sure everything works fine.

115200 is the baud rate I'm using
matt.stevenson offline
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm

Post by snest » Thu Jul 29, 2010 2:32 am

Post by snest
Thu Jul 29, 2010 2:32 am

Hey Matt
It's taken a while but I finally got Ubuntu and Slitaz running. Unfortunately, I've spent the whole day today on trying to get this serial communication up but without much luck. I tried your suggestion on Slitaz, but even though I see the boot screen, I don't see the boot process itself or the log in.

Ubuntu gets even more tricky since it doesn't inittab, but rather some other files in /etc/event.d. I have had more luck with it, getting it through the whole boot process, but still I cannot get a log in.

I am also using 115200 Baud rate and was beginning to think that perhaps it was too fast, but since you got yours to work at that speed that shouldn't be the case.

Any other suggestions?
Also, how did your wlan card set up go after getting this to work?
Hey Matt
It's taken a while but I finally got Ubuntu and Slitaz running. Unfortunately, I've spent the whole day today on trying to get this serial communication up but without much luck. I tried your suggestion on Slitaz, but even though I see the boot screen, I don't see the boot process itself or the log in.

Ubuntu gets even more tricky since it doesn't inittab, but rather some other files in /etc/event.d. I have had more luck with it, getting it through the whole boot process, but still I cannot get a log in.

I am also using 115200 Baud rate and was beginning to think that perhaps it was too fast, but since you got yours to work at that speed that shouldn't be the case.

Any other suggestions?
Also, how did your wlan card set up go after getting this to work?
snest offline
Robot Builder
Robot Builder
Posts: 20
Joined: Thu Jul 22, 2010 10:00 pm

Post by matt.stevenson » Thu Jul 29, 2010 10:10 pm

Post by matt.stevenson
Thu Jul 29, 2010 10:10 pm

Hmmm, I don't know how much I can help you with ubuntu. I'm away from my home for a few weeks, so I can't hop on my ubuntu box to look at it.

I may have some time in the next couple days to do a little digging for you.

As for the mimPCI wifi card, I managed to compile and install the driver. It took me a while because I had to first recompile the kernel to support wifi.

If you decide to give the Debian guide a shot, I'd be happy to give you my kernel, the header files, and the compiled driver.

If you (or anyone else) want those, PM me your email address and I'll send it to you.

I'm pretty busy today, but I should be able to get to it tonight.
Hmmm, I don't know how much I can help you with ubuntu. I'm away from my home for a few weeks, so I can't hop on my ubuntu box to look at it.

I may have some time in the next couple days to do a little digging for you.

As for the mimPCI wifi card, I managed to compile and install the driver. It took me a while because I had to first recompile the kernel to support wifi.

If you decide to give the Debian guide a shot, I'd be happy to give you my kernel, the header files, and the compiled driver.

If you (or anyone else) want those, PM me your email address and I'll send it to you.

I'm pretty busy today, but I should be able to get to it tonight.
matt.stevenson offline
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm

Post by snest » Fri Jul 30, 2010 12:06 am

Post by snest
Fri Jul 30, 2010 12:06 am

I got Ubuntu to work. Just had to specify the kernel to boot as single (to tell it not to use the GUI).

Unfortunately I am still struggling with Slitaz, which is the system I really want to use because of it's light weight. I still see the boot configuration screen and bios, but the actual boot process and the login still evade me.

Correct me if I am wrong, but getty is responsible for waking up the serial port, right?



I've added this to /etc/inittab:

Code: Select all
s0:2345:respawn:/sbin/getty ttyS0 115200 vt100


And I have also made a few modifications to /boot/grub/menu.lst in order to get the boot loader to use console.
I got Ubuntu to work. Just had to specify the kernel to boot as single (to tell it not to use the GUI).

Unfortunately I am still struggling with Slitaz, which is the system I really want to use because of it's light weight. I still see the boot configuration screen and bios, but the actual boot process and the login still evade me.

Correct me if I am wrong, but getty is responsible for waking up the serial port, right?



I've added this to /etc/inittab:

Code: Select all
s0:2345:respawn:/sbin/getty ttyS0 115200 vt100


And I have also made a few modifications to /boot/grub/menu.lst in order to get the boot loader to use console.
snest offline
Robot Builder
Robot Builder
Posts: 20
Joined: Thu Jul 22, 2010 10:00 pm

Post by matt.stevenson » Fri Jul 30, 2010 7:12 am

Post by matt.stevenson
Fri Jul 30, 2010 7:12 am

That line should work fine, the line I posted will automatically log you in.
That line should work fine, the line I posted will automatically log you in.
matt.stevenson offline
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm


11 postsPage 1 of 1
11 postsPage 1 of 1
cron