Hello,
I have came across an issue when using LPC2368 micro USB in CDC mode I get errors at random time of communication and after them all communication stops.
At the moment system is using V1.10 USB driver from keil examples, USB initializing correctly, data is transferring ok also until error case. Data sending is started from timer which runs at 1ms period, and fills endpoint buffer if any data is ready to be sent and previous data on EP was sent(that is detected if EP_in event was fired)
9:54:37.587> !BuffEmpty || bWait //Data out buffer not empty in TIM __irq 9:54:37.587> Buff += 64B //temp buffer filled with data 9:54:37.587> EP_Send 64B //temp buffer sent to EP to start sending 9:54:37.587> EP_in //EP_in received ACK in USB __irq 9:54:37.587> !BuffEmpty || bWait //Same 9:54:37.587> Buff += 64B 9:54:37.587> EP_Send 64B 9:54:37.587> EP_in 9:54:37.587> !BuffEmpty || bWait //Same 9:54:37.587> Buff += 41B 9:54:37.587> EP_Send 41B 9:54:37.587> EP_in 9:54:38.086> !BuffEmpty || bWait //Same 9:54:38.086> Buff += 27B 9:54:38.086> EP_Send 27B 9:54:38.086> EP_in 9:54:43.078> !BuffEmpty || bWait //Same 9:54:43.078> Buff += 21B 9:54:43.078> EP_Send 21B 9:54:43.078> EP_in 9:54:43.515> ERROR - 0040|001D //Errors started firing 9:54:43.515> ERROR - 0001|0011 //1st DWORD is ERROR status (SIE command 0xFB) 9:54:43.515> ERROR - 0041|001D //2nd DWORD is ERROR code (SIE command 0xFF) 9:54:43.515> ERROR - 0001|0011 9:54:44.201> !BuffEmpty || bWait //Trying to send next data from TIM __irq 9:54:44.201> Buff += 48B //without handling received error 9:54:44.201> EP_Send 48B 9:54:44.201> !bInterrupt //TIM __irq is detecting that EP_in ACK event wasn't fired yet ... ... ... 9:54:44.201> !bInterrupt 9:54:44.201> !bInterrupt 9:54:44.201> ERROR - 0040|001D //same stuff is repeating over and over again 9:54:44.201> !bInterrupt //Errors are firing and data stored in EP_in buffer 9:54:44.201> !bInterrupt //isn't sending or EP_in ACK event isn't happening 9:54:44.201> !bInterrupt 9:54:44.201> ERROR - 0041|001D 9:54:44.201> ERROR - 0001|0011 9:54:44.201> ERROR - 0040|001D 9:54:44.201> !bInterrupt 9:54:44.201> !bInterrupt 9:54:44.201> ERROR - 0001|0011 9:54:44.201> ERROR - 0040|001D 9:54:44.201> ERROR - 0041|001D 9:54:44.201> ERROR - 0041|0011 9:54:44.201> !bInterrupt 9:54:44.201> !bInterrupt 9:54:44.201> ERROR - 0040|001D 9:54:44.201> ERROR - 0001|0011 9:54:44.201> ERROR - 0041|001D 9:54:44.201> ERROR - 0041|0011 9:54:44.201> ERROR - 0040|001D 9:54:44.201> !bInterrupt 9:54:44.201> !bInterrupt ... ... ...
maybe anyone have any suggestions how to act in such situation in order to restore communication?
Thank you in advance, Laurynas
> P.S. if you have any link containing information on how to write USB driver under windows that would be very helpful.
You don’t need to write a custom driver. WinUSB - Windows in-box generic driver - is available.
A. Error recovery WinUSB should suffer the bulk IN transaction error, like any other drivers. Instead of usbser.sys, WinUSB reports the error to your PC application. And then, your PC application retries the transfer a couple of times, until it succeeds.
PC host controller defers error report until the next SOF timing. While your PC application retires the transfer, a couple of milliseconds goes on. And then, the burst noise should end up. USB hardwares have error detection, handshake and retry on both sides. When the transfer successfully finishes on the PC application, it should get correct data from the device.
B. Installation No INF file is required, for WinUSB device installation to a Windows PC. MS OS descriptors, returned by your device, replace INF file.
MS have enabled this mechanism for WinUSB at Windows 8. But actually, this mechanism had introduced since XP-SP3. A couple of USB classes (RNDIS and MTP) have been blessed by this mechanism. Actually, MS quietly distribute a driver, which enables this mechanism for WinUSB on XP, Vista and 7, for Windows Phone.
MS-official "WinUSB class" driver for XP, Vista and 7 www.microchip.com/.../m790429.aspx
Tsuneo