usb transfer between PC and de2 board

HI everyone,

I'm trying to send 16 byte data block from PC to DE2 board and then the DE2 board will transfer back the data to PC using bulk transfer.(working environment : window Xp)

For the firmware part, I do modify the ReadEndpoint, WriteEndpoint and SetEndpointConfiguration to read and write 16 bytes data. But I still can?t get the correct result.

What had I miss? Can somebody help me?

Thanks, summer

--------------------------------------- Posted through

formatting link

Reply to
summer5
Loading thread data ...

"summer5" skrev i meddelelsen news:e7adnYqLapvxZP3WnZ2dnUVZ snipped-for-privacy@giganews.com...

A USB bus analyzer.

formatting link

Leo Havmøller.

Reply to
Leo Havmøller

Hi,

Thanks for the reply. :>

i had change the coding.

This is the coding from HAL4D13.c USHORT Hal4D13_ReadEndpoint(UCHAR bEPIndex, UCHAR *buf, USHORT len) { USHORT i, j, c; IOWR(ISP1362_BASE,D13_COMMAND_PORT, D13CMD_EP_RD_FIFO + bEPIndex); /* read Buffer */ j = IORD(ISP1362_BASE,D13_DATA_PORT); if(j > len) j = len; i=0; while (i8); i++; buf++; } /* Clear Buffer */ IOWR(ISP1362_BASE,D13_COMMAND_PORT, D13CMD_EP_CLEAR_BUF+bEPIndex); return j;

}

Do anyone knows the meaning of *buf = (UCHAR)(c>>8)? Especially the(c>>8) in the coding. Is it is shift to right for 8 bytes?

Thanks, Summer

--------------------------------------- Posted through

formatting link

Reply to
summer5

With the assumption that USHORT == 16bit and UCHAR == 8bit, the code in the inner loop first copies the lower 8 bits from the 16 bit word in c to the location pointed to by buf and then copies the higher 8 bits from the 16 bit word to the next location ion the buffer.

(c>>8) shifts the higher 8 bits in the 16 bit word to the lower 8 bits.

Without knowing much about USB communication, it seems to me that if the requested len is less than available (j) you loose the difference because you only copy len characters at most and then declare the transaction complete!

Antoon

Reply to
Jaded Hobo

Hi,

may i know is the USB bus analyzer is in software form like hardware in SOPC of Quartus II or we need buy a real exist hardware?

Thanks, Summer

--------------------------------------- Posted through

formatting link

Reply to
summer5

hi, if i use the software only USB analyzer, can i able to check what is going wrong in my DE2-side code? As i check from internet and it says software only USB analyzer only useful for checking PC-side code.

thanks, summer

--------------------------------------- Posted through

formatting link

Reply to
summer5

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.