ts-7000
[Top] [All Lists]

Re: [ts-7000] COM2 serial problem on TS-7260

To: "" <>
Subject: Re: [ts-7000] COM2 serial problem on TS-7260
From: Alexandre Maurer <>
Date: Wed, 20 Oct 2010 17:34:16 +0200
You have a serial console running on com2. Check /etc/inittab

Le 14 oct. 2010 Ã 11:16, Petr Åtetiar <> a Ãcrit :

> yetanotherdjmorris <> [2010-10-12 20:57:47]:
>
>> I have a TS-7260 trying to communicate with an RS232 device (a motor).  I
>> can open my port, set my baud, send data to the device, the motor moves,
>> sends a response back, which I can read.  Then I start a polling loop where
>> I continually call iReturn = ioctl(fd, FIONREAD, &iBytesAvail) and then
>> sleep for 20ms.  Eventually (like after 100 iterations), this returns -1
>> with an errno = EIO  (input/output error).  I can close the port and reopen
>> and it works, but again, only for a few seconds before I get that error
>> again.
>>
>> Any thoughts?
>
> I'm repeating myself, but why is everybody reinventing the wheel again and
> again? I know, that using RS232 port is such a common task, that I wrote a
> library[1] for it, licensed it under very liberal MIT license, so everybody
> can use it. You can use it in the same way under Linux, Windows and even under
> Windows CE/Mobile. There's even a Lua bindings, so you can use it for fast
> prototyping, example (-- is one line comment in Lua):
>
> :~/$ lua
> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>> rs232 = require("luars232") -- loads the RS232 library
>>
>> error, port = rs232.open("/dev/ttyAM0") -- opens the port
>> port:set_baud_rate(rs232.RS232_BAUD_115200) -- sets baudrate to 115200
>>
>> read = 5 -- read just bytes
>> timeout = 20 -- miliseconds
>> error, data, len = port:read(read, timeout) -- read the data
>> if len == read then -- if we've read 5 bytes, send OK to the sender
>>    port:write("OK\n")
>> end
>> port:close() -- cleanup
>
> BTW Lua is really fast, so in most of the cases, I would say in 99%, you don't
> even need to write any C code, you'll just need to compile the luars232
> library and Lua. You can even prototype it on the desktop PC and then just
> copy the final Lua script to the device and it should work in the same way as
> it was working on the desktop. Easy, fast.
>
> 1. http://github.com/ynezz/librs232
>
> -- ynezz
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
    
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU