why USB_BulkWrite inside USB_BulkRead

Dragon

why USB_BulkWrite inside USB_BulkRead

Postby Neetu » Sat Oct 09, 2010 5:35 pm

Hi,

I am not much into programming hence this question.In the office I have been handed over this Dragon PCI FPGA Board. I am able to write to the FPGA using the simple codes provided by you ( as indicated by LEDs). But I am unable to read what I have written into it.

As I am trying to find out why I cannot read back the one byte of data I have written into it I am quite baffled as to why you need USB_BulkWrite inside USB_BulkRead as in

void USB_Read(void* buffer, WORD buffersize)
{
if(buffersize==0) return;
USB_BulkWrite(6, &buffersize, 2);
USB_BulkRead(3, buffer, buffersize);
}

like in the initial USB_BulkWrite the value is 2. what is this pipe value which is changing from 2to 6 to 3. Commenting that portion makes the simple C console program get stuck.

I would like help in reading back what I have written into it+ the explanation of code.

thnx in advance
Neetu
Neetu
 
Posts: 2
Joined: Fri Oct 08, 2010 7:09 pm
Location: India

Postby fpga4fun » Sun Oct 10, 2010 4:46 pm

What did you program in the FPGA?
You have to look at the code you programmed into the FPGA to see what value it would return on a read.

Also the write before a read is there to indicate to the USB controller how many bytes you are going to read. Make sure to read the board doc, chapter 4 and forward, and study the board USB tutorials.
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Postby Neetu » Sun Oct 10, 2010 6:08 pm

I burned the USB IO8 program available with the Dragon Start up Kit.
Is this the right way to read back the data
void main()
{
BYTE b[1*8];
void USB_Open();
USB_WriteByte(07);
USB_Read(b,sizeof(b));
printf("%b", b);
void USB_Close();
exit(0);
}


thnx
Neetu
Neetu
 
Posts: 2
Joined: Fri Oct 08, 2010 7:09 pm
Location: India


Return to PCI FPGA board