On Thu, Oct 18, 2012 at 12:31 AM, Juan Pablo Carbajal
<ajuanpi+...@gmail.com> wrote:
> Hello,
>
> I am observing weird behaviors and I couldn't pin down at which level
> things are going bad. Using instrument-control 0.1.0 from Forge.
> Running Ubuntu 12.04 64 bit
> Linux 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012
> x86_64 x86_64 x86_64 GNU/Linux
>
> I am using serial communications. I am testing with a physical
> loopback (RxD connected to TxD) in this USB2Serial adapter
> https://www.sparkfun.com/products/718.
>
> Problem 1 [Ring bufffer?]:
>   s = serial (); # 8-N-1
>   srl_baudrate (s,9600);
>
>   srl_write(s,"hello")
>   ans = 5
>
>   char(srl_read (s,5))
>   ans = hello
>
>   char(srl_read (s,5))
>   ans = hello
>
>   char(srl_read (s,15))
>   ans = hellohellohello
>
>   char(srl_read (s,4))
>   ans = hell
>
>   char(srl_read (s,6))
>   ans = ohello
>
> It looks like as if the buffer is a ring buffer or is really big and
> filled with "hello". Maybe flushing the input after reading will solve
> the problem? Continued from the example before I got this
>
> Problem 2 [Hang after flush]:
>   srl_flush (s, 1)
>
>   char(srl_read (s,5)) # This blocks as expected but ...
>   srl_read: Interrupting...
>   ans =
>
>   srl_write(s,"hello")
>   ans =  5
>
>   char(srl_read (s,5)) # This also blocks!!!!
>   srl_read: Interrupting...
>   ans =
>
> The only way of getting things to work from this point on is to close
> the port and open it again.
>
> Can anybody reproduce this? any suggestions of tests to run to see
> whether the problem is at hardware level?
>
> I also tested with a virtual loopback (command "socat -d -d PTY:
> PTY:", this is simpler than the suggestion in the wiki. I can update
> that), I do not observe Problem 1, but I can't interrupt the second
> call to srl_read
>
> s = serial("/dev/ptmx", 9600);
> srl_write(s,"hello")
> ans =  5
> char(srl_read (s,5))
> ans = hello
> octave:5> char(srl_read (s,5))
> srl_read: Interrupting...
> srl_read: Interrupting...
> srl_read: Interrupting...
> srl_read: Interrupting...
>
>
> Thanks

Testing in Debian Squeeze 2.6.32-5-686 with the same hardware
configuration doesn't show Problem 1
Note that:

- Ubuntu 12.04 uses kernel 3.2.0 and the driver controlling the adapter is
ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

- Debian Squeeze uses kernel 2.6.32 and
ftdi_sio: v1.5.0:USB FTDI Serial Converters Driver


In Debian the problem observed is the following (opening the port the
same as before)
> srl_write(s,uint8(127)); srl_read(s,1)
ans = 127
> srl_write(s,uint8(128)); srl_read(s,1)
ans = 0

Should it go up to 255?

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to