read 1 byte data

All about Sub-20 Multi Interface USB Adapter USB to I2C, SPI, GPIO, RS232, RS485, Ir, LCD

Moderator: serg

Post Reply
sreejith6320
Posts: 12
Joined: Tue Mar 22, 2011 9:46 am

read 1 byte data

Post 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.
Last edited by sreejith6320 on Tue Apr 26, 2011 12:58 pm, edited 2 times in total.

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: read 1 byte data

Post 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

sreejith6320
Posts: 12
Joined: Tue Mar 22, 2011 9:46 am

Re: read 1 byte data

Post by sreejith6320 »

Sorry, it was returning -7 by mistake I wrote -5 which corresponds to bulk write failed

serg
Posts: 143
Joined: Mon Aug 31, 2009 9:17 pm

Re: read 1 byte data

Post by serg »

So what do you get now, i.e after applying all the fixes above?

Post Reply