Reply by summer5 February 1, 20102010-02-01
>"summer5" <mhchang514@gmail.com> skrev i meddelelsen >news:e7adnYqLapvxZP3WnZ2dnUVZ_tednZ2d@giganews.com... >> 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&acirc;&euro;&trade;t get the correct result. >> >> What had I miss? > >A USB bus analyzer. > >> Can somebody help me? > >http://www.ellisys.com/ > >Leo Havm&oslash;ller. >
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 http://www.EmbeddedRelated.com
Reply by summer5 February 1, 20102010-02-01
>"summer5" <mhchang514@gmail.com> skrev i meddelelsen >news:e7adnYqLapvxZP3WnZ2dnUVZ_tednZ2d@giganews.com... >> 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&acirc;&euro;&trade;t get the correct result. >> >> What had I miss? > >A USB bus analyzer. > >> Can somebody help me? > >http://www.ellisys.com/ > >Leo Havm&oslash;ller.
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 http://www.EmbeddedRelated.com
Reply by Jaded Hobo February 1, 20102010-02-01
summer5 wrote:
> 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 (i<j)//<< > //for(i=0; i<j; i=i+2, buf++ ) > { > c = IORD(ISP1362_BASE,D13_DATA_PORT); > *buf = (UCHAR)c; > i++; > if (i >= j) break; > buf++; > *buf = (UCHAR)(c>>8); > 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? >
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 by summer5 February 1, 20102010-02-01
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 (i<j)//<<
	//for(i=0; i<j; i=i+2, buf++ )
	{
		c = IORD(ISP1362_BASE,D13_DATA_PORT);
		*buf = (UCHAR)c;
		i++;
		if (i >= j) break; 
		buf++;
		*buf = (UCHAR)(c>>8);
		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 http://www.EmbeddedRelated.com
Reply by Leo Havmøller January 28, 20102010-01-28
"summer5" <mhchang514@gmail.com> skrev i meddelelsen 
news:e7adnYqLapvxZP3WnZ2dnUVZ_tednZ2d@giganews.com...
> 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&acirc;&euro;&trade;t get the correct result. > > What had I miss?
A USB bus analyzer.
> Can somebody help me?
http://www.ellisys.com/ Leo Havm&oslash;ller.
Reply by summer5 January 27, 20102010-01-27
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&rsquo;t get the correct result.

What had I miss? 
Can somebody help me?

Thanks,
summer


	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com