none
USBSER driver issue RRS feed

  • Question

  • Hi All,

    I am using a USB modem for my wince system.I copied the driver from the public folder and compiled it under my BSP to create USBSER.dll

     

    When i insert the modem it gets detected and USBSerial driver is Attached.

    In the initialization it fails in the function:

    UsbClassPipe::Init()

     

    Following is registry setting for modem(usbser) :-
    [HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_5190\Default\Default\USBSER_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"

    [HKEY_LOCAL_MACHINE\Drivers\USB\ClientDrivers\USBSER_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"
       "DeviceArrayIndex"=dword:1
       "RxBufferSize"=dword:4000
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"

    [HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_5190\Default\Default\SERIAL_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"

    [HKEY_LOCAL_MACHINE\Drivers\USB\ClientDrivers\SERIAL_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"
       "RxBufferSize"=dword:4000
       "DeviceArrayIndex"=dword:0
       "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"

    Can any one has a clue to this issue.

     

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    Tuesday, January 10, 2012 1:28 PM

All replies

  • Hi All,

     

    Can anybody has any clue to the mentioned problem ?


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    Thursday, January 12, 2012 9:32 AM
  • Enabling the debug zones to get the debug logs may provide some clues.
    Sunday, January 15, 2012 7:37 AM
  • Hi All,

    I did the following reg settings due to which now the driver is inserting correctly:

    /------------------------------------------------------------------------------------------------------------------------/

    [HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\Default\USBSER_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"

    [HKEY_LOCAL_MACHINE\Drivers\USB\ClientDrivers\USBSER_CLASS]
       "Prefix"="COM"
       "Dll"="USBSer.DLL"
       "DeviceArrayIndex"=dword:2
       "RxBufferSize"=dword:4000
       "Index"=dword:2
       ;"IClass"="{2C3D239D-D718-42a6-A446-290BE1886FD0}"
       ;"IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"
       "IClass"=multi_sz:"{2C3D239D-D718-42a6-A446-290BE1886FD0}","{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}","{C375C787-B721-4b8e-B67F-A112D5C0A404}"

    ;[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\5652_2048\Default\Default\SERIAL_CLASS]
    ;[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_5190\Default\Default\SERIAL_CLASS]
    ;;[HKEY_LOCAL_MACHINE\Drivers\USB\LoadClients\4817_4097\Default\Default\SERIAL_CLASS]
    ;;   "Prefix"="COM"
    ;;   "Dll"="USBSer.DLL"

    ;;[HKEY_LOCAL_MACHINE\Drivers\USB\ClientDrivers\SERIAL_CLASS]
    ;;   "Prefix"="COM"
    ;;   "Dll"="USBSer.DLL"
    ;;   "RxBufferSize"=dword:4000
    ;;   "DeviceArrayIndex"=dword:0
    ;;   "IClass"="{CC5195AC-BA49-48a0-BE17-DF6D1B0173DD}"

     

    /-------------------------------------------------------------------------------------------------------------------------------------/

    But still the issue with data being send in/out is not happening, the detailed log is as :

     

    /****************************************************************************************/

    PID:00400002 TID:0473007A USB Modem Device Attach
    PID:00400002 TID:0473007A +UsbClientDevice::InitPID:00400002 TID:0473007A UsbClientDevice::AttachPID:00400002 TID:0473007A UsbClientDevice::Attach: Found Supported Interface (bInterfaceNumber=0,bAlternateSetting=0PID:00400002 TID:0473007A +CreateSerialObject, DeviceArrayIndex=2
    PID:00400002 TID:0473007A +CreateSerialObject, DeviceArrayIndex is 2 ###
    PID:00400002 TID:0473007A +UsbSerClientDriver::Init
                                                       PID:00400002 TID:0473007A +UsbSerClientDriver::CreateBulkIn
    PID:00400002 TID:0473007A SerialDataIn::Init()
    PID:00400002 TID:0473007A ++UsbAsyncClassPipe::Init()called ...
    PID:00400002 TID:0473007A UsbAsyncClassPipe::Init() return true +++
    PID:00400002 TID:0473007A +UsbSerClientDriver::CreateBulkOut
    PID:00400002 TID:0473007A  SerialDataOut::Init()
    PID:00400002 TID:0473007A ++UsbAsyncClassPipe::Init()called ...
    PID:00400002 TID:0473007A  UsbAsyncClassPipe::Init returns TRUE m_hThreadRun=587007b, wMaxPacketSize=64
    PID:00400002 TID:0473007A  UsbAsyncClassPipe::Init returns FALSE m_hThreadRun=587007b, wMaxPacketSize=64
    PID:00400002 TID:0473007A -UsbSerClientDriver::Init(m_lpSerialDataIn =de2aeae0, m_lpSerialDataOut =de2aebf0 ,m_lpUsbSerDataStatus=0 )
                                                                                                                                         PID:00400002 TID:0473007A -CreateSerialObject, pSerialPDD=de2ae960
    PID:00400002 TID:0473007A -UsbClientDevice::Init return 1PID:00400002 TID:0473007A pUsbDevice->Init called
    PID:00400002 TID:04EE007A  SerialDataIn::ThreadRun()
    PID:00400002 TID:04EE007A  SerialDataIn::thread in while loop
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun()
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047400EE +UsbSerClientDriver::SetBaudRate()
    PID:00400002 TID:047400EE +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047400EE -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047400EE +UsbSerClientDriver::SetByteSize()
    PID:00400002 TID:047400EE +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047400EE -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047400EE +UsbSerClientDriver::SetParity()
    PID:00400002 TID:047400EE +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047400EE -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047400EE +UsbSerClientDriver::SetStopBits(ULONG StopBits)
    PID:00400002 TID:047400EE +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047400EE -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047400EE SerialDataIn::InitReceive()
    PID:00400002 TID:047400EE UsbAsyncClassPipe::ResetPipe fForce=1
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90000, dwClientInfo=fedd0000
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90000,0x84012000, return=1
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90400, dwClientInfo=fedd0001
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90400,0x84012400, return=1
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90800, dwClientInfo=fedd0002
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90800,0x84012800, return=1
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90c00, dwClientInfo=fedd0003
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90c00,0x84012c00, return=1
    PID:00400002 TID:047400EE  SerialDataOut::InitXmit()
    PID:00400002 TID:047400EE UsbAsyncClassPipe::ResetPipe fForce=1
    PID:00400002 TID:04EE007A  SerialDataIn::thread unblocked
    PID:00400002 TID:04EE007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=fedd0000
    PID:00400002 TID:047400EE  SerialDataIn::CancelReceive()
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun() unblocked ...
    PID:00400002 TID:042A007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=0
    PID:00400002 TID:042A007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=0
    PID:00400002 TID:042A007A +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=de2aebf0, pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:042A007A  SerialDataOut::XmitInterruptHandler() pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:042A007A Else condition ---> ResetEvent()
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047400EE +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047400EE -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047400EE m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047400EE  SerialDataIn::CancelReceive() under while ...4
    PID:00400002 TID:047400EE UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0000
    PID:00400002 TID:04EE007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=de2aed40
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90000, dwClientInfo=fedd0000
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90000,0x84012000, return=1
    PID:00400002 TID:047400EE +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047400EE -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047400EE m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047400EE  SerialDataIn::CancelReceive() under while ...3
    PID:00400002 TID:047400EE UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0001
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90400, dwClientInfo=fedd0001
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90400,0x84012400, return=1
    PID:00400002 TID:047400EE +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047400EE -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047400EE m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047400EE  SerialDataIn::CancelReceive() under while ...2
    PID:00400002 TID:047400EE UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0002
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90800, dwClientInfo=fedd0002
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90800,0x84012800, return=1
    PID:00400002 TID:047400EE +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047400EE -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047400EE m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047400EE  SerialDataIn::CancelReceive() under while ...1
    PID:00400002 TID:047400EE UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0003
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdef90c00, dwClientInfo=fedd0003
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdef90c00,0x84012c00, return=1
    PID:00400002 TID:047400EE +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047400EE -UsbTransfer::IsTransferComplete () 0
    PID:00400002 TID:047400EE m_lpArmedTranfser->IsTransferComplete() returns=0
    PID:00400002 TID:04EE007A +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:04EE007A -UsbTransfer::IsTransferComplete () 0
    PID:00400002 TID:04EE007A m_lpArmedTranfser->IsTransferComplete() returns=0
    PID:00400002 TID:04EE007A  SerialDataIn::thread in while loop
    PID:00400002 TID:04EE007A  SerialDataIn::thread unblocked
    PID:00400002 TID:04EE007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=fedd0000
    PID:00400002 TID:04EE007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=de2aed40
    PID:04730126 TID:047400EE COM2 port found
    PID:00400002 TID:047400EE +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=de2aebf0, pTxBuffer=-1002077200, pBuffLen=2
    PID:00400002 TID:047400EE  SerialDataOut::XmitInterruptHandler() pTxBuffer=c44583f0, pBuffLen=2
    PID:00400002 TID:047400EE +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,2,0xc44583f0, dwClientInfo=0
    PID:00400002 TID:047400EE +UsbTransfer::IssueBulkTransfer flags=768
    PID:00400002 TID:047400EE m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047400EE -UsbAsyncClassPipe::BulkOrIntrTransfer:0xc44583f0,0x0, return=1
    PID:00400002 TID:047400EE IsEmptyTransferAvailable() returns true--->>> SetEvent(m_hThreadRun)
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun() unblocked ...
    PID:00400002 TID:042A007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=0
    PID:00400002 TID:042A007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=deec0ef0
    PID:00400002 TID:042A007A +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=de2aebf0, pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:042A007A  SerialDataOut::XmitInterruptHandler() pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:042A007A UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=0
    PID:00400002 TID:042A007A Else condition ---> ResetEvent()
    PID:00400002 TID:042A007A   SerialDataOut::ThreadRun() in loop ...
    PID:04730126 TID:047400EE  Bytes written virtual port2 =2
    PID:04730126 TID:047400EE  No of Bytes read from the port2 =0

    /*************************************************************************************************************/

     

    Can you please analyze the issue and provide some support ?

     

    Thanks in advance.

    --- Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    • Proposed as answer by sarmapranjal Tuesday, January 17, 2012 5:44 PM
    • Unproposed as answer by sarmapranjal Tuesday, January 17, 2012 5:44 PM
    Monday, January 16, 2012 1:40 PM
  • From the above logs, looks like something is going wrong in SerialDataIn::InitReceive. Normally after the SerialDataIn::Receive(), there should be a call to SerialDataIn::ReceiveInterruptHandler(). But could see any such log. I would suggest debugging the SerialDataIn::InitReceive and check if anything is going wrong.

     

    Tuesday, January 17, 2012 5:50 PM
  • Nothing looks to be wrong with "SerialDataIn::InitReceive" during the debugging i found that it is setting the event when i run the application to receive through the port as "InitReceive() SetEvent-->m_hThreadRun"

     

    When the application is closed it is resetting as "InitReceive() ResetEvent-->m_hThreadRun"

     

    SerialDataIn::CancelReceive() is called in between and then i could see no "SerialDataIn::ReceiveInterruptHandler()" getting called to receive the data. The application returns with 0 byte read.

     

    Please see the log below :-

    /**************************************************************************************/

    PID:00400002 TID:0491007A USB Modem Device Attach
    PID:00400002 TID:0491007A +UsbClientDevice::InitPID:00400002 TID:0491007A UsbClientDevice::AttachPID:00400002 TID:0491007A USB Modem No of Endpoints=2
    PID:00400002 TID:0491007A USB Modem BulkIn=1 BulkOut=1
    PID:00400002 TID:0491007A UsbClientDevice::Attach: Found Supported Interface (bInterfaceNumber=0,bAlternateSetting=0PID:00400002 TID:0491007A +CreateSerialObject, DeviceArrayIndex=2
    PID:00400002 TID:0491007A +CreateSerialObject, DeviceArrayIndex is 2 ###
    PID:00400002 TID:0491007A +UsbSerClientDriver::Init
    PID:00400002 TID:0491007A +UsbSerClientDriver::CreateBulkIn
    PID:00400002 TID:0491007A SerialDataIn::Init()
    PID:00400002 TID:0491007A ++UsbAsyncClassPipe::Init()called ...
    PID:00400002 TID:0491007A UsbAsyncClassPipe::Init() return true +++
    PID:00400002 TID:0491007A m_VirtualAddress is not NULL m_dwNumOfSegment=4, m_dwTotalSize=4096, m_dwSegmentSize=1024 Thread Started
    PID:00400002 TID:0491007A +UsbSerClientDriver::CreateBulkOut
    PID:00400002 TID:0491007A  SerialDataOut::Init()
    PID:00400002 TID:0491007A ++UsbAsyncClassPipe::Init()called ...
    PID:00400002 TID:0491007A  UsbAsyncClassPipe::Init returns TRUE m_hThreadRun=5300077, wMaxPacketSize=64
    PID:00400002 TID:0491007A -UsbSerClientDriver::Init(m_lpSerialDataIn =ded445e0, m_lpSerialDataOut =ded446f0 ,m_lpUsbSerDataStatus=0 )
                                                                                                                                         PID:00400002 TID:0491007A -CreateSerialObject, pSerialPDD=ded44460
    PID:00400002 TID:0491007A -UsbClientDevice::Init return 1PID:00400002 TID:0491007A pUsbDevice->Init called
    PID:00400002 TID:05DB007A  SerialDataIn::ThreadRun()
    PID:00400002 TID:05DB007A  SerialDataIn::thread in while loop !!!
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun()
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047101C2 +UsbSerClientDriver::SetBaudRate()
    PID:00400002 TID:047101C2 +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047101C2 -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047101C2 +UsbSerClientDriver::SetByteSize()
    PID:00400002 TID:047101C2 +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047101C2 -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047101C2 +UsbSerClientDriver::SetParity()
    PID:00400002 TID:047101C2 +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047101C2 -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047101C2 +UsbSerClientDriver::SetStopBits(ULONG StopBits)
    PID:00400002 TID:047101C2 +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047101C2 -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047101C2 SerialDataIn::InitReceive() bInit=1
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::ResetPipe fForce=1
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70000, dwClientInfo=fedd0000
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70000,0x84011000, return=1
    PID:00400002 TID:047101C2 SerialDataIn::InitReceive() dwIndex=0
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70400, dwClientInfo=fedd0001
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70400,0x84011400, return=1
    PID:00400002 TID:047101C2 SerialDataIn::InitReceive() dwIndex=1
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70800, dwClientInfo=fedd0002
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70800,0x84011800, return=1
    PID:00400002 TID:047101C2 SerialDataIn::InitReceive() dwIndex=2
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70c00, dwClientInfo=fedd0003
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70c00,0x84011c00, return=1
    PID:00400002 TID:047101C2 SerialDataIn::InitReceive() dwIndex=3
    PID:00400002 TID:047101C2 InitReceive() SetEvent-->m_hThreadRun
    PID:00400002 TID:047101C2  SerialDataOut::InitXmit()
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::ResetPipe fForce=1
    PID:00400002 TID:05DB007A  SerialDataIn::thread unblocked
    PID:00400002 TID:05DB007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=fedd0000
    PID:00400002 TID:047101C2  SerialDataIn::CancelReceive()
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() unblocked ...
    PID:00400002 TID:04B3006A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=0
    PID:00400002 TID:04B3006A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=0
    PID:00400002 TID:04B3006A +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=ded446f0, pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A  SerialDataOut::XmitInterruptHandler() pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A Else condition ---> ResetEvent()
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047101C2 +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047101C2 -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:05DB007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=ded447d0
    PID:00400002 TID:047101C2 m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047101C2  SerialDataIn::CancelReceive() under while ...4
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0000
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70000, dwClientInfo=fedd0000
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70000,0x84011000, return=1
    PID:00400002 TID:047101C2 +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047101C2 -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047101C2 m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047101C2  SerialDataIn::CancelReceive() under while ...3
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0001
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70400, dwClientInfo=fedd0001
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70400,0x84011400, return=1
    PID:00400002 TID:047101C2 +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047101C2 -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047101C2 m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047101C2  SerialDataIn::CancelReceive() under while ...2
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0002
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70800, dwClientInfo=fedd0002
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70800,0x84011800, return=1
    PID:00400002 TID:047101C2 +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047101C2 -UsbTransfer::IsTransferComplete () 1
    PID:00400002 TID:047101C2 m_lpArmedTranfser->IsTransferComplete() returns=1
    PID:00400002 TID:047101C2  SerialDataIn::CancelReceive() under while ...1
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=fedd0003
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,1024,0xdee70c00, dwClientInfo=fedd0003
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=896
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xdee70c00,0x84011c00, return=1
    PID:00400002 TID:047101C2 +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:047101C2 -UsbTransfer::IsTransferComplete () 0
    PID:00400002 TID:047101C2 m_lpArmedTranfser->IsTransferComplete() returns=0
    PID:00400002 TID:05DB007A +UsbTransfer::IsTransferComplete ()
    PID:00400002 TID:05DB007A -UsbTransfer::IsTransferComplete () 0
    PID:00400002 TID:05DB007A m_lpArmedTranfser->IsTransferComplete() returns=0
    PID:00400002 TID:05DB007A  SerialDataIn::thread in while loop !!!
    PID:00400002 TID:05DB007A  SerialDataIn::thread unblocked
    PID:00400002 TID:05DB007A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=fedd0000
    PID:00400002 TID:05DB007A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=ded447d0
    PID:00400002 TID:047101C2 +UsbSerClientDriver::SetBaudRate()
    PID:00400002 TID:047101C2 +UsbClientDevice::IssueVendorTransfer Setup(21,20,0,0,8), length=0,dwTimeout=2000PID:00400002 TID:047101C2 -UsbClientDevice::IssueVendorTransfer return 1PID:00400002 TID:047101C2 +UsbSerClientDriver::SetDTR()
    PID:00400002 TID:047101C2 +UsbSerClientDriver::SetRTS()
    PID:00400002 TID:047101C2 +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=ded446f0, pTxBuffer=-1002076944, pBuffLen=2
    PID:00400002 TID:047101C2  SerialDataOut::XmitInterruptHandler() pTxBuffer=c44584f0, pBuffLen=2
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,2,0xc44584f0, dwClientInfo=0
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=768
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xc44584f0,0x0, return=1
    PID:00400002 TID:047101C2 IsEmptyTransferAvailable() returns true--->>> SetEvent(m_hThreadRun) *pBuffLen=2
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() unblocked ...
    PID:00400002 TID:04B3006A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=0
    PID:00400002 TID:04B3006A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=dee08720
    PID:00400002 TID:04B3006A +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=ded446f0, pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A  SerialDataOut::XmitInterruptHandler() pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=0
    PID:00400002 TID:04B3006A Else condition ---> ResetEvent()
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047101C2 +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=ded446f0, pTxBuffer=-1002076944, pBuffLen=2
    PID:00400002 TID:047101C2  SerialDataOut::XmitInterruptHandler() pTxBuffer=c44584f0, pBuffLen=2
    PID:00400002 TID:047101C2 +UsbAsyncClassPipe::BulkOrIntrTransfer:0x300,2,0xc44584f0, dwClientInfo=0
    PID:00400002 TID:047101C2 +UsbTransfer::IssueBulkTransfer flags=768
    PID:00400002 TID:047101C2 m_lpEmptyTranfser->IssueBulkTransfer()
    PID:00400002 TID:047101C2 -UsbAsyncClassPipe::BulkOrIntrTransfer:0xc44584f0,0x0, return=1
    PID:00400002 TID:047101C2 IsEmptyTransferAvailable() returns true--->>> SetEvent(m_hThreadRun) *pBuffLen=2
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() unblocked ...
    PID:00400002 TID:04B3006A +UsbAsyncClassPipe::WaitForTransferComplete:-1,dwClientInfo=0
    PID:00400002 TID:04B3006A +UsbTransfer::WaitForTransferComplete dwTicks=-1 nCount=0 lpHandles=0 m_hUsbTransfer=dee08720
    PID:00400002 TID:04B3006A +UsbSerClientDriver::XmitInterruptHandler() m_lpSerialDataOut=ded446f0, pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A  SerialDataOut::XmitInterruptHandler() pTxBuffer=0, pBuffLen=0
    PID:00400002 TID:04B3006A UsbAsyncClassPipe::CloseFrontArmedTransfer:dwClientInfo=0
    PID:00400002 TID:04B3006A Else condition ---> ResetEvent()
    PID:00400002 TID:04B3006A   SerialDataOut::ThreadRun() in loop ...
    PID:00400002 TID:047101C2  SerialDataOut::InitXmit()
    PID:00400002 TID:047101C2 SerialDataIn::InitReceive() bInit=0
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseAllArmedTransfer:dwClientInfo=fedd0000
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseAllArmedTransfer:dwClientInfo=fedd0001
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseAllArmedTransfer:dwClientInfo=fedd0002
    PID:00400002 TID:047101C2 UsbAsyncClassPipe::CloseAllArmedTransfer:dwClientInfo=fedd0003
    PID:00400002 TID:047101C2 InitReceive() ResetEvent-->m_hThreadRun
    PID:00400002 TID:05DB007A  SerialDataIn::thread in while loop !!!

    /*********************************************************************************************/

     

    ---Misbah


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    Wednesday, January 18, 2012 9:17 AM
  • I investigated further and found that the function to receive below is failing with error "usb_stall_error" = 4:-

    Application read calls -

    if(!ReadFile(hSerial,&szBuffer[0],2,&dBytesReadSerial,NULL))

     

    Log shows -

    SerialDataIn::ReceiveInterruptHandler() pRxBuffer=dee70000, Bufflen=32767

    ReceiveInterruptHandler:Transfer Error 4 ,dwLength=0

    ------------------------------------------------------------------------------------------------------------------------------------------------

    BOOL SerialDataIn::ReceiveInterruptHandler(__out_bcount(*pBufflen) PUCHAR pRxBuffer,ULONG *pBufflen)
    {
        Lock();
        BOOL bReturn = FALSE;
        if (pRxBuffer && pBufflen && *pBufflen)
        {
            DWORD dwBufferSize = *pBufflen ;
            *pBufflen = 0 ;
            if ( IsFrontArmedTransferComplete () )
            {

                RETAILMSG(1, (TEXT("SerialDataIn::ReceiveInterruptHandler() pRxBuffer=%x, Bufflen=%d\r\n"),pRxBuffer,dwBufferSize));

                if (m_dwSegDataDataLen[m_dwCurIndex] == 0)
                { // Have't update the Transfer Status yet.
                    DWORD dwClientInfo = GetClientInfo();
                    ASSERT((dwClientInfo & SERIAL_DATAIN_COOKIE_MASK)== SERIAL_DATAIN_COOKIE);
                    ASSERT(m_dwCurIndex == (dwClientInfo & (~SERIAL_DATAIN_COOKIE_MASK)));
                    m_dwCurIndex =(dwClientInfo & (~SERIAL_DATAIN_COOKIE_MASK));
                    DWORD dwError = USB_NO_ERROR;
                    DWORD dwLength;
                    if (GetFrontArmedTransferStatus(&dwLength, &dwError) && dwError == USB_NO_ERROR) //misbah for testing only
                    { // Complete with no error.
                        m_dwSegDataOffset[m_dwCurIndex] = 0;
                        m_dwSegDataDataLen[m_dwCurIndex] = min(dwLength,m_dwSegmentSize);
                        DWORD dwCopyLength = min(m_dwSegDataDataLen[m_dwCurIndex],dwBufferSize);
                        memcpy(pRxBuffer,m_VirtualAddress + m_dwSegmentSize*m_dwCurIndex ,dwCopyLength);
                        m_dwSegDataOffset[m_dwCurIndex] = dwCopyLength;
                        *pBufflen = dwCopyLength;
                        bReturn = TRUE;
                        RETAILMSG(1,(TEXT("ReceiveInterruptHandler:%d Copied  ,Transfer Size=%d\r\n"),dwCopyLength,dwLength));
                    }
                    else
                    {
                        RETAILMSG(1,(TEXT("ReceiveInterruptHandler:Transfer Error %d ,dwLength=%d\r\n"),dwError,dwLength));

                    }
                    RETAILMSG(1,(TEXT("// Have't update the Transfer Status yet.\r\n")));
                }
                else
                {
                    RETAILMSG(1,(TEXT("// Have't update the Transfer Status yet ELSE \r\n")));
                    if (m_dwSegDataOffset[m_dwCurIndex] < m_dwSegDataDataLen[m_dwCurIndex] )
                    { // We have Extra.
                        DWORD dwCopyLen = min (dwBufferSize, m_dwSegDataDataLen[m_dwCurIndex] - m_dwSegDataOffset[m_dwCurIndex]) ;
                        memcpy(pRxBuffer,m_VirtualAddress + (m_dwSegmentSize*m_dwCurIndex + m_dwSegDataOffset[m_dwCurIndex]) ,dwCopyLen);
                        *pBufflen = dwCopyLen;
                        m_dwSegDataOffset[m_dwCurIndex] += dwCopyLen;
                        bReturn = TRUE;

                        RETAILMSG(1,(TEXT("// // We have Extra. \r\n")));
                    }
                }

                if (m_dwSegDataOffset[m_dwCurIndex]>= m_dwSegDataDataLen[m_dwCurIndex] )
                {
                    CloseFrontArmedTransfer();
                    m_dwSegDataOffset[m_dwCurIndex]= m_dwSegDataDataLen[m_dwCurIndex] =  0 ;
                    VERIFY(BulkOrIntrTransfer(USB_NO_WAIT|USB_SHORT_TRANSFER_OK,
                        m_dwSegmentSize,
                        m_VirtualAddress+ (m_dwCurIndex * m_dwSegmentSize),
                        m_PhysicalAddress.QuadPart!=0?(m_PhysicalAddress.LowPart+(m_dwCurIndex*m_dwSegmentSize)):0,
                        SERIAL_DATAIN_COOKIE+m_dwCurIndex));
                    m_dwCurIndex ++;
                    if (m_dwCurIndex>=NUM_OF_IN_TRANSFER)
                        m_dwCurIndex = 0;
                }
            }
        }
        Unlock();
        return bReturn;
    }

     

    -----------------------------------------------------------------------------------------------------------------------------------------------------

    What could be the possible causes of this error ???

     

    ---- Misbah

     


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    • Edited by Misbah Khan Wednesday, January 18, 2012 1:51 PM
    Wednesday, January 18, 2012 1:32 PM
  • Usb stall error occurs when a usb transfer is halted and the Halted bit in the USB HC is set to 1. This is an error condition, where no further transfer can progress unless the stall is cleared.

    The possible causes I could think of are:

    1. Improper data transfer, sending commands that are not interpretted.

    2. Faulty hardware.

    Since usb stall error is obtained, i think using usbser.dll directly may not be the correct thing for usb modem

     

    Wednesday, January 18, 2012 5:16 PM
  • Thanks for your valuable comment.

    Need support for the following points :-

    1. USB modem is working in Linux for the same H/W. Hence i dont think there is any issue with the H/W. What can be done to avoid this halt error (value 4) in WinCE?

     

    2. I am trying to send AT command just "AT" to the modem. WriteFile succeeds with 2 bytes transmitted (See the above log) but ReadFile leads to halt error, but before that somebody calls "SerialDataIn::CancelReceive()" (pls see above log) Why and Who ? How to deal with this problem ?

     

    3. SerialDataIn::ReceiveInterruptHandler() pRxBuffer=dee70000, Bufflen=32767 the buffer length passed by the application is 2 bytes, but the function gets the arg as "Bufflen=32767"

    4. If you dont suggest to use usbser.dll for USB modem then what shall we use ? Linux and other OS has drivers , similarly WinCE should support or may be a third party driver ? Already i asked this question to the community but i didnt got any reply. Any suggestion please ?

     

    These four points really bugs me and i am searching for an answer, any of you has a clue ?

    Regards,

    --- Misbah

     

     


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com

    • Edited by Misbah Khan Thursday, January 19, 2012 8:46 AM
    Thursday, January 19, 2012 5:26 AM
  • 1. Halt conditions can be cleared by client drivers by clearing the endpoints (reset) and re-trying.

    2. Only debugging can help here.

    3. Integer overflow???

    Monday, January 23, 2012 5:50 PM
  • I will try to fix the issue related to first three points with the suggestions you have given. And hope that this will fix the problem.

     

    Still i am searching for the answer to my fourth question. if any of you have a suggestion, please do share.

     

    I wish USB modem should work in WinCE as it is working under other OS like Linux, Android ...

     

    ---Misbah 


    Senior Design Engineer T.E.S Electroni Solutions (Bangalore-India) www.tes-dst.com email-misbah.khan@tes-dst.com
    Wednesday, January 25, 2012 6:09 AM
  • Hi,

    Did you find anything concerning this error? I think I have the same thing here.

    Friday, April 6, 2012 12:01 PM