Page 1 of 1

read 1 byte data

Posted: Mon Apr 25, 2011 1:42 pm
by sreejith6320
I have a master which sends the data through SPI which is to displayed on the LCD of resolution 128 X 64. Here in my project I need to read that data but 1byte at a time. So how can I use the sub_fifo_read() to do the same or please suggest any other way to do that.

I tried this way:
rc = sub_fifo_read( hndl, in_buff,1,100);

but it returns a value -5 and sometimes 0.

Re: read 1 byte data

Posted: Tue Apr 26, 2011 1:36 am
by serg
Let's use the latest snapshot , i.e the SUB-20-snap-110319.tgz,
So first, modify the source

1.
change the libusb.c, line 1989
from

Code: Select all

rc = libusb_bulk_transfer( hndl, SUB_FIFO_IN_EP, (unsigned char*)buf, 
to

Code: Select all

rc = libusb_bulk_transfer( hndl, SUB_FIFO_IN_EP, (unsigned char*)tmp_buf, 
2. Comment out the
from

Code: Select all

#define ASYNC_OUT
to

Code: Select all

/*
#define ASYNC_OUT
*/
Rebuild the library.

Now, call the sub_fifo_read function again and let me know what you get

Re: read 1 byte data

Posted: Tue Apr 26, 2011 12:58 pm
by sreejith6320
Sorry, it was returning -7 by mistake I wrote -5 which corresponds to bulk write failed

Re: read 1 byte data

Posted: Tue Apr 26, 2011 4:16 pm
by serg
So what do you get now, i.e after applying all the fixes above?