Hi All,
I am writing a Custom WDM USB-UART driver(Single VIRTUAL COM PORT)
for FTDI's FT232R chipset.
In my InitializationModule() and startdeviceroutine() I could able to
Get the device descriptor
and configure the Device perfectly. I am getting the Interface and
pipe information correctly.

My problem is after start device, If I try to Read data from the
device by calling the following
//Satrt the request
ulFlags = USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK;

UsbBuildInterruptOrBulkTransferRequest(pCtx->m_pUrb,
sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER),
hPipe,
pbBuffer, NULL, cbBuffer, ulFlags, NULL);

// Setup completion proc
IoSetCompletionRoutine(pCtx->m_pIrp,(PIO_COMPLETION_ROUTINE)
RequestCompletedThunk,pCtx,TRUE,TRUE,TRUE);

// Call next device with this IRP
status = IoCallDriver(pCtx->DeviceExtension-
>TopOfStackDeviceObject, pCtx->m_pIrp);

in My Completion routine I am getting 2 bytes of junk data, Which is
unexpected(There is no data kept in port).
When I open the Virtual Com Port and write some data bytes, still I am
getting these 2 junk bytes.

I tried to resolve this issue by resetting the pipe. Still problem
exists.
Can anybody help me to get rid of that unnecessary junk bytes.
Your valuable suggestions are always appriciated.

Thanks in advance.

~Vijji

Re: FTDI's FT232R chipset Junk data bytes by Ben

Ben
Thu Oct 11 09:37:37 PDT 2007


<vijayaraju.k@gmail.com> wrote in message
news:1192094078.176225.79620@d55g2000hsg.googlegroups.com...
> Hi All,
> I am writing a Custom WDM USB-UART driver(Single VIRTUAL COM PORT)
> for FTDI's FT232R chipset.
> In my InitializationModule() and startdeviceroutine() I could able to
> Get the device descriptor
> and configure the Device perfectly. I am getting the Interface and
> pipe information correctly.
>
> My problem is after start device, If I try to Read data from the
> device by calling the following
> //Satrt the request
> ulFlags = USBD_TRANSFER_DIRECTION_IN | USBD_SHORT_TRANSFER_OK;
>
> UsbBuildInterruptOrBulkTransferRequest(pCtx->m_pUrb,
> sizeof(struct _URB_BULK_OR_INTERRUPT_TRANSFER),
> hPipe,
> pbBuffer, NULL, cbBuffer, ulFlags, NULL);
>
> // Setup completion proc
> IoSetCompletionRoutine(pCtx->m_pIrp,(PIO_COMPLETION_ROUTINE)
> RequestCompletedThunk,pCtx,TRUE,TRUE,TRUE);
>
> // Call next device with this IRP
> status = IoCallDriver(pCtx->DeviceExtension-
>>TopOfStackDeviceObject, pCtx->m_pIrp);
>
> in My Completion routine I am getting 2 bytes of junk data, Which is
> unexpected(There is no data kept in port).
> When I open the Virtual Com Port and write some data bytes, still I am
> getting these 2 junk bytes.

You are receiving the data transferred across the USB bus, which is not the
same as the data received on the serial port.

I imagine that FTDI has an envelope carrying the serial data. Certainly
these chips are capable of a lot more than simple RS-232 communication.

>
> I tried to resolve this issue by resetting the pipe. Still problem
> exists.
> Can anybody help me to get rid of that unnecessary junk bytes.
> Your valuable suggestions are always appriciated.

I'm aware that there's a linux driver for ftdi chips, this should provide
documentation of ftdi's higher level protocol.

If you make a driver supporting these chips that doesn't bluescreen, I want
it too.

>
> Thanks in advance.
>
> ~Vijji
>