Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Maemo: Developers

Connecting RS232 devices to N800 hosting OS2008

 

 

Maemo developers RSS feed   Index | Next | Previous | View Threaded


tuxslayer at gmail

Jan 30, 2008, 10:07 AM

Post #1 of 7 (3425 views)
Permalink
Connecting RS232 devices to N800 hosting OS2008

Hi All,

There was several threads about using N800 USB host mode, and
Sebastian told us that its no problem to use N800 USB with Silabs
Serial converter.

I need to connect an RS232 device to N800 with OS2008 image uploaded.

The questions is:

How should I use this port?
a) will it be available as serial port? (some kind of tty?) where I
should look for drivers?

b) Should I communicate thru it as thru USB device? Any suggestions on
API, libraries? Or maybe I can just open() some character device from
/dev/ and read/write it? how in this case writed data will be mapped
to serial port's output?

c) for serial port I need to set up the baud rate, stop bits, etc. how
should I deal with it when device is connected thru USB?

Thanks for any ideas!

Best regards,
Aleksey Yashchenko
_______________________________________________
maemo-developers mailing list
maemo-developers[at]maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


winston at ee

Jan 30, 2008, 11:03 AM

Post #2 of 7 (3180 views)
Permalink
Re: Connecting RS232 devices to N800 hosting OS2008 [In reply to]

Would you mind using the Bluetooth interface instead of USB on the N800 for
your RS-232 device?
You can get serial-to-Bluetooth converter like this one:
http://www.rovingnetworks.com/blueportxp.htm
Just a thought...



----- Original Message -----
From: "Aleksey Yashchenko" <tuxslayer[at]gmail.com>
To: <maemo-developers[at]maemo.org>
Sent: Wednesday, January 30, 2008 10:07 AM
Subject: Connecting RS232 devices to N800 hosting OS2008


> Hi All,
>
> There was several threads about using N800 USB host mode, and
> Sebastian told us that its no problem to use N800 USB with Silabs
> Serial converter.
>
> I need to connect an RS232 device to N800 with OS2008 image uploaded.
>
> The questions is:
>
> How should I use this port?
> a) will it be available as serial port? (some kind of tty?) where I
> should look for drivers?
>
> b) Should I communicate thru it as thru USB device? Any suggestions on
> API, libraries? Or maybe I can just open() some character device from
> /dev/ and read/write it? how in this case writed data will be mapped
> to serial port's output?
>
> c) for serial port I need to set up the baud rate, stop bits, etc. how
> should I deal with it when device is connected thru USB?
>
> Thanks for any ideas!
>
> Best regards,
> Aleksey Yashchenko
> _______________________________________________
> maemo-developers mailing list
> maemo-developers[at]maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

_______________________________________________
maemo-developers mailing list
maemo-developers[at]maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


gerry.box at gmail

Jan 30, 2008, 12:31 PM

Post #3 of 7 (3190 views)
Permalink
Re: Connecting RS232 devices to N800 hosting OS2008 [In reply to]

I think the SILABS converter is based on the ftdi chipset. Fanoush on
www.internettablettalk.com had released a set of drivers compiled for
OS2008.

http://www.internettablettalk.com/forums/showpost.php?p=101312&postcount=5

insmod the driver, run dmesg | tail to see if the converter got detected.
You can talk to the serial chip via /dev/ttyUSB0.


On Jan 30, 2008 12:07 PM, Aleksey Yashchenko <tuxslayer[at]gmail.com> wrote:

> Hi All,
>
> There was several threads about using N800 USB host mode, and
> Sebastian told us that its no problem to use N800 USB with Silabs
> Serial converter.
>
> I need to connect an RS232 device to N800 with OS2008 image uploaded.
>
> The questions is:
>
> How should I use this port?
> a) will it be available as serial port? (some kind of tty?) where I
> should look for drivers?
>
> b) Should I communicate thru it as thru USB device? Any suggestions on
> API, libraries? Or maybe I can just open() some character device from
> /dev/ and read/write it? how in this case writed data will be mapped
> to serial port's output?
>
> c) for serial port I need to set up the baud rate, stop bits, etc. how
> should I deal with it when device is connected thru USB?
>
> Thanks for any ideas!
>
> Best regards,
> Aleksey Yashchenko
> _______________________________________________
> maemo-developers mailing list
> maemo-developers[at]maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>



--
Homepage: http://www.machinegrid.com :: Robots at Work!!


j.kemp at alliedtranstech

Jan 30, 2008, 8:23 PM

Post #4 of 7 (3177 views)
Permalink
Connecting RS232 devices to N800 hosting OS2008 [In reply to]

I'm using a N810, but the problem of connecting a RS232 device is probably
the same.

I'm getting close to getting a RS232 connection working using Bluetooth and
Python2.5. The code below is getting me close. I can receive RS232 string
over Bluetooth using this code. I just can't seem to figure out how to send
string out. If I try and use PySerial package I get an error when trying to
open the port.

#! /usr/bin/env python2.5
import dbus
import time
import sys
import thread
#import serial

PortOpen = 0
ser = ""

#
=============================================================================
def OpenPort ( COM_Port ):
global ser, PortOpen
try:
print "Opening %s port" % COM_Port
#ser = serial.Serial( COM_Port, 115200, timeout=0, parity=
serial.PARITY_NONE, rtscts=0)
ser = open( COM_Port, 'r+' )
PortOpen = 1
except:
print "Error opening serial port."
exit()


#
=============================================================================
def CommThread ( tid ):
""" This function is designed to be run as a thread task. """
global gTID, PortOpen
gTID = tid
i = 0
while PortOpen:
s = ser.readline( ).strip( '\r\n' )
print s
print "CommThread Ending %d" % PortOpen

bus = dbus.SystemBus()
bmgr = dbus.Interface( bus.get_object('org.bluez', '/org/bluez'), '
org.bluez.Manager')
bus_id = bmgr.ActivateService('serial')
serial = dbus.Interface(bus.get_object( bus_id, '/org/bluez/serial'), '
org.bluez.serial.Manager')

# Service connection, read the serial API to check the available patterns
address = "00:01:95:06:CF:88"
service = "spp"

# Bind to the default local adapter
device = serial.ConnectService( address, service )
print "Connected %s to %s" % (device, address)

time.sleep(1)
OpenPort( device )
thread.start_new( CommThread, (1234,) )

print "Press CTRL-C to disconnect"

while(1):
s = raw_input()
print "Writting %s" % s
ser.write(s)
ser.flush()

serial.DisconnectService(device)


abiryan at ryand

Jan 30, 2008, 10:33 PM

Post #5 of 7 (3171 views)
Permalink
Re: Connecting RS232 devices to N800 hosting OS2008 [In reply to]

Have you checked the permissions on the device file to ensure that your
user ("user") has write permissions (and/or tried running this as root?)

Ryan

James Kemp wrote:
> I'm using a N810, but the problem of connecting a RS232 device is
> probably the same.
>
> I'm getting close to getting a RS232 connection working using
> Bluetooth and Python2.5. The code below is getting me close. I can
> receive RS232 string over Bluetooth using this code. I just can't seem
> to figure out how to send string out. If I try and use PySerial
> package I get an error when trying to open the port.
>
> #! /usr/bin/env python2.5
> import dbus
> import time
> import sys
> import thread
> #import serial
>
> PortOpen = 0
> ser = ""
>
> #
> =============================================================================
> def OpenPort ( COM_Port ):
> global ser, PortOpen
> try:
> print "Opening %s port" % COM_Port
> #ser = serial.Serial( COM_Port, 115200, timeout=0,
> parity=serial.PARITY_NONE, rtscts=0)
> ser = open( COM_Port, 'r+' )
> PortOpen = 1
> except:
> print "Error opening serial port."
> exit()
>
>
> #
> =============================================================================
> def CommThread ( tid ):
> """ This function is designed to be run as a thread task. """
> global gTID, PortOpen
> gTID = tid
> i = 0
> while PortOpen:
> s = ser.readline( ).strip( '\r\n' )
> print s
> print "CommThread Ending %d" % PortOpen
>
> bus = dbus.SystemBus()
> bmgr = dbus.Interface( bus.get_object('org.bluez', '/org/bluez'),
> 'org.bluez.Manager')
> bus_id = bmgr.ActivateService('serial')
> serial = dbus.Interface(bus.get_object( bus_id, '/org/bluez/serial'),
> 'org.bluez.serial.Manager')
>
> # Service connection, read the serial API to check the available patterns
> address = "00:01:95:06:CF:88"
> service = "spp"
>
> # Bind to the default local adapter
> device = serial.ConnectService( address, service )
> print "Connected %s to %s" % (device, address)
>
> time.sleep(1)
> OpenPort( device )
> thread.start_new( CommThread, (1234,) )
>
> print "Press CTRL-C to disconnect"
>
> while(1):
> s = raw_input()
> print "Writting %s" % s
> ser.write(s)
> ser.flush()
>
> serial.DisconnectService(device)
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> maemo-developers mailing list
> maemo-developers[at]maemo.org
> https://lists.maemo.org/mailman/listinfo/maemo-developers
>

_______________________________________________
maemo-developers mailing list
maemo-developers[at]maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


tuxslayer at gmail

Jan 31, 2008, 1:04 PM

Post #6 of 7 (3162 views)
Permalink
Re: Connecting RS232 devices to N800 hosting OS2008 [In reply to]

Thanks Gerard,

It helps me much!
The solution proposed by Winston (to use Bluetooth adapter) is also
good, but its more expensive ($100 vs $19 for USB-Serial).

Does, moreover, if ftdi driver emulates Serial port its just what I
need, because I can change serial port settings thru appropriate API.

Thanks.
Aleksey Yashchenko

On 30/01/2008, Gerard Sequeira <gerry.box[at]gmail.com> wrote:
> I think the SILABS converter is based on the ftdi chipset. Fanoush on
> www.internettablettalk.com had released a set of drivers compiled for
> OS2008.
>
> http://www.internettablettalk.com/forums/showpost.php?p=101312&postcount=5
>
> insmod the driver, run dmesg | tail to see if the converter got detected.
> You can talk to the serial chip via /dev/ttyUSB0.
>
>
>
> On Jan 30, 2008 12:07 PM, Aleksey Yashchenko <tuxslayer[at]gmail.com> wrote:
> >
> > Hi All,
> >
> > There was several threads about using N800 USB host mode, and
> > Sebastian told us that its no problem to use N800 USB with Silabs
> > Serial converter.
> >
> > I need to connect an RS232 device to N800 with OS2008 image uploaded.
> >
> > The questions is:
> >
> > How should I use this port?
> > a) will it be available as serial port? (some kind of tty?) where I
> > should look for drivers?
> >
> > b) Should I communicate thru it as thru USB device? Any suggestions on
> > API, libraries? Or maybe I can just open() some character device from
> > /dev/ and read/write it? how in this case writed data will be mapped
> > to serial port's output?
> >
> > c) for serial port I need to set up the baud rate, stop bits, etc. how
> > should I deal with it when device is connected thru USB?
> >
> > Thanks for any ideas!
> >
> > Best regards,
> > Aleksey Yashchenko
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers[at]maemo.org
> >
> https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
>
>
>
> --
> Homepage: http://www.machinegrid.com :: Robots at Work!!


--
best regards,
[SLAYER]
_______________________________________________
maemo-developers mailing list
maemo-developers[at]maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


j.kemp at alliedtranstech

Jan 31, 2008, 5:14 PM

Post #7 of 7 (3158 views)
Permalink
Re: Connecting RS232 devices to N800 hosting OS2008 [In reply to]

Nope, running as root does not help. Seems like the script gets stuck on the
write to the port. The ser.write(s) never returns.

Thanks for the tip anyway.

Jim

On Jan 31, 2008 1:33 AM, Ryan Pavlik <abiryan[at]ryand.net> wrote:

> Have you checked the permissions on the device file to ensure that your
> user ("user") has write permissions (and/or tried running this as root?)
>
> Ryan
>
> James Kemp wrote:
> > I'm using a N810, but the problem of connecting a RS232 device is
> > probably the same.
> >
> > I'm getting close to getting a RS232 connection working using
> > Bluetooth and Python2.5. The code below is getting me close. I can
> > receive RS232 string over Bluetooth using this code. I just can't seem
> > to figure out how to send string out. If I try and use PySerial
> > package I get an error when trying to open the port.
> >
> > #! /usr/bin/env python2.5
> > import dbus
> > import time
> > import sys
> > import thread
> > #import serial
> >
> > PortOpen = 0
> > ser = ""
> >
> > #
> >
> =============================================================================
> > def OpenPort ( COM_Port ):
> > global ser, PortOpen
> > try:
> > print "Opening %s port" % COM_Port
> > #ser = serial.Serial( COM_Port, 115200, timeout=0,
> > parity=serial.PARITY_NONE, rtscts=0)
> > ser = open( COM_Port, 'r+' )
> > PortOpen = 1
> > except:
> > print "Error opening serial port."
> > exit()
> >
> >
> > #
> >
> =============================================================================
> > def CommThread ( tid ):
> > """ This function is designed to be run as a thread task. """
> > global gTID, PortOpen
> > gTID = tid
> > i = 0
> > while PortOpen:
> > s = ser.readline( ).strip( '\r\n' )
> > print s
> > print "CommThread Ending %d" % PortOpen
> >
> > bus = dbus.SystemBus()
> > bmgr = dbus.Interface( bus.get_object('org.bluez', '/org/bluez'),
> > 'org.bluez.Manager')
> > bus_id = bmgr.ActivateService('serial')
> > serial = dbus.Interface(bus.get_object( bus_id, '/org/bluez/serial'),
> > 'org.bluez.serial.Manager')
> >
> > # Service connection, read the serial API to check the available
> patterns
> > address = "00:01:95:06:CF:88"
> > service = "spp"
> >
> > # Bind to the default local adapter
> > device = serial.ConnectService( address, service )
> > print "Connected %s to %s" % (device, address)
> >
> > time.sleep(1)
> > OpenPort( device )
> > thread.start_new( CommThread, (1234,) )
> >
> > print "Press CTRL-C to disconnect"
> >
> > while(1):
> > s = raw_input()
> > print "Writting %s" % s
> > ser.write(s)
> > ser.flush()
> >
> > serial.DisconnectService(device)
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers[at]maemo.org
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> >
>
>
>


--
Allied Transportation Technology, Inc.
Jim Kemp
1465 Combermere Dr.
Troy, MI 48083
Ph: (248) 616-2100 Ext: 28
Cell: (248) 930-7709

Maemo developers RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.