libftdi Archives

Subject: Re: background read

From: "Anton A. Litvinov" <mirteney@xxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 6 Jul 2010 18:59:33 +0600
Cheerfull news

ftdi_readstream with libftdi1.0-HEAD-b013bcb works form me nicely
136.0 kB/s totalrate, data is consistent, no misses

Structure of my program:

reader(){
    ...
    ftdi_readstream(&ftdic, readCallBack, NULL, 8, 256);
    ...
}
main(){
    ....
    pthread_create ( reader )
    while(){
       ...
       ftdi_write_data()
       ...
    }
    ...
}

Thought the number 8 seems "magic" for me.
For example changing it to 12 leads to rare callback invocation and
to floating point exception

Core was generated by `./test3'.
Program terminated with signal 8, Arithmetic exception.
[New process 7272]
#0  0x00007f8977a14c0a in ftdi_readstream_cb (transfer=0x19da9c0) at
/home/anton/src/libftdi-1.0-HEAD-b013bcb/src/ftdi_stream.c:75
75             int numPackets = (length + packet_size - 1) / packet_size;




2010/7/6 Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:
>>>>>> "Anton" == Anton A Litvinov <mirteney@xxxxxxxxx> writes:
>
>    Anton> Hello I am writing a program that should a) continuously read
>    Anton> data from FTDI-port in the background and store it into file.  b)
>    Anton> receive some commands from stdin and do appropriate writes into
>    Anton> FTDI-port
>
>    Anton> Questions 1.  can a) and b) run in different threads or I should
>    Anton> place read and write into a cycle in one thread and read(stdin)
>    Anton> -- in another ?  and establish link beetween one to another by
>    Anton> means of queue (fifo) ?
>
>    Anton> 2.  or maybe I should use some kind of non-blocking read ?
>
> It all depends on data rate and reliability requirements. You can have a
> look at ftdi_stream.c in libftdi-1.0 and the discussion around it. It should
> give you a goos start.
>
> Bye
> --
> Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
> --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
>
>



-- 
With best regards.
Anton

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread