Re: USB data Transfer question



I tested the HID Keyboard and Mouse, and they works fine.
I never test Storagecard.

Charles


"voidcoder" wrote:


Ok, are you sure your USB Host driver is ok? What about other
drivers, eg. HIDs and Mass Storage? Do they work properly?


"Charles Wang" <CharlesWang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:079C6970-5B85-4AC3-ACC8-2166CFDDC36B@xxxxxxxxxxxxxxxx
After I sent 64 bytes packet in Client,
I got the complete string repeatedly.

in Client, I send SlaveMsg[64]="Hello \r\n";
in Host, I read Message like
"Hello
Hello
Hello
..."

If I send
{
send SlaveMsg[64]="Hello \r\n";
memset[tmp, 0, 64];
send tmp[64];
}

I can get the correct the string, but in Host driver
xxx_read() , IssueBulkTransfer() function always failed,
Message <IssueBulkTransfer error:dwErr 1f, dwUsbErr 0x6>




"Voidcoder" wrote:

the BufferLength is always 1, and the Data

I'm afraid you can't pass 1-byte length buffer
when reading data, use at least 1 full packet size
(64 bytes for bulk transfers) buffer instead. This is
not a serial port, if the controller receives a packet
(lets say short 5-byte packet when you send "hello"),
but the request has only 1-byte associated buffer then
the driver possibly gets confused.


"Charles Wang" <CharlesWang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:48FE1737-C327-4B88-BB4F-A8FAF7236278@xxxxxxxxxxxxxxxx
I am sorry, I made mistake in last post.
Actually in xxx_read(), the pBuffer !=0 if there is data sending from client.
but not continuosly.

eg. I only have "hello" sending from client, and I may see in xxx_read()
*pBuffer=="h", the next read might be "h" again or maybe "l".

It's the same as what I got in my app for read the dwBytesTransferred is 1
only when
*pBuffer not equal to 0.

Should I create a even to monitor the buffer?



the BufferLength is always 1, and the Data

"Voidcoder" wrote:

Looks ok. What do you pass as BufferLength?
And what does the &dwBytesTransferred
show when the function returns. Also
how much data you are sending from the
client when the trouble happens?


"Charles Wang" <CharlesWang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B33B0FC6-61D1-45EF-8C05-3AE55350F43E@xxxxxxxxxxxxxxxx
Thanks for the reply!

Here is the code :
//===xxx_Read===
dwErr = IssueBulkTransfer (pUsbSIS->UsbFuncs,
pUsbSIS->BulkIn.hPipe, DefaultTransferComplete, //Callback
pUsbSIS->BulkIn.hEvent, //Context
(USB_IN_TRANSFER|USB_SHORT_TRANSFER_OK), //Flags pBuffer, 0, //
*pBuffer==0 here
BufferLength, &dwBytesTransferred, dwTimeout,
&dwUsbErr);

//===Write===
dwErr = IssueBulkTransfer( pUsbSIS->UsbFuncs,
pUsbSIS->BulkOut.hPipe,
DefaultTransferComplete, // Callback
pUsbSIS->BulkOut.hEvent, // Context
(USB_OUT_TRANSFER /*
pBuffer, 0, //*pBuffer equal to the
data I trying to transfered
dwTransferSize,
&dwBytesTransferred,
dwTimeout,
&dwUsbErr );


"Voidcoder" wrote:

Post your IssueBulkTransfer call here. I'm not sure, but may
be something is wrong there.

"Charles Wang" <Charles Wang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4CAD4799-7723-48B1-BD16-A8228EDF2A26@xxxxxxxxxxxxxxxx
The USB host and Client are CE device.

When I read the data from Client, in my app I can see the data "hello" in
the first several times and then start dumpping like "heeeeeeee...".
when I tried to printf out the value of pBuffer in IssueBulkTransfer(..,
pBuffer,),
the value is always 0 even though I can see the data correctly in my app.

As I said in OP, I can write data from host to client, I can see the data in
my app running in client, and both USB analizer and the pBuffer value is the
right value I am trying to transfer.

Any ideas?



"Charles Wang" wrote:

I guess the USB2Serial driver you mentioned is the USB Function Client driver.
The driver I worte is for host. I want to Read/Write into USB hostport as a
comport.



"voidcoder" wrote:

May be I'm missing something, but CE already includes
USB2Serial driver... what are you doing exactly? Give us
some details. For example you may want to tell
is your device USB Host or USB Device, and what is
on the oposite side? Desktop? Different device?



"Charles Wang" <CharlesWang@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:50614146-40A1-46CC-9B25-F99D79DBDA39@xxxxxxxxxxxxxxxx
I wrote a USB to Serial driver on CE ARM device.
and the write function which write data from USB host to client works
fine,
but when tried to read data from client, just occasionally get the serial
data, most likely, host only read partial data.

USB analizer tells that Writing from USB host to Client works fine, but
always error when I tried to read data from Client, no matter I got data
complete or not.
eg. if I write "Hello" in Client, I can read "Hello" in the beginning some
times, then I'll get "HHH......" or "lllll....." or "oooo..." randomly.
The
USB analizer always tells "no data".

Any ideas?

















.



Relevant Pages

  • ieee1394 and fbdev oops in 2.6.3rc2
    ... Found UniNorth PCI host bridge at 0xf0000000. ... Firmware bus number: 0->0 ... PMU driver 2 initialized for Core99, ... ohci_hcd 0001:02:08.0: new USB bus registered, ...
    (Linux-Kernel)
  • Re: USB host controller and client driver
    ... Realy appreciate your reply on Host controller and Function controller ... Well I am absolutelly clear now with host controller driver ... "The USB function controller drvers come into picture only if your ...
    (microsoft.public.windowsce.platbuilder)
  • Re: USB data Transfer question
    ... "voidcoder" wrote: ... are you sure your USB Host driver is ok? ... I only have "hello" sending from client, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: What do i need to activate my USB host
    ... > There are bluetooth driver in my dev. ... But since no usb host ... You should determine what kind of host controller your PXA250 platform ...
    (microsoft.public.windowsce.platbuilder)
  • Re: USB data Transfer question
    ... "Partition Driver" ... USB Analizer gives very similar message ... HCD driver, it can write data correctly to USB Client, and read from USB ...
    (microsoft.public.windowsce.platbuilder)

Loading