USB CDC Clear Endpoint

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB CDC Clear Endpoint

484 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by togi on Thu Jul 26 09:30:26 MST 2012
Dear developers,

I build a measurement system with a LPCXpresso 1769 and transfer the sampled data via USBCDC to the PC. Only when the event Callback came on the Endpoint In a new data block is written in the Endpoint Buffer. Control  characters are send to the measurement system to start and stop the aquisition. Now I want to reset the Endpoint In buffer before i restart the aquisition. I use the "Clear Buffer" command from the USB command code. But now after a restart of the aquisition there is no event callback on the Endpoint. Without the Clear Buffer command the system works properly. The reason why i would like to reset the buffer is to avoid old data.

Thanks for your help,

Best regards Tom
0 项奖励
回复
2 回复数

416 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by togi on Fri Jul 27 04:11:09 MST 2012
Thanks for your reply.

Before I restart the system the serial buffer on the PC is already flushed. Then there must be another problem.

Best regards,
Tom
0 项奖励
回复

416 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Fri Jul 27 02:48:36 MST 2012

Quote:
Now I want to reset the Endpoint In buffer before i restart the aquisition. I use the "Clear Buffer" command from the USB command code.


Do you mean you've applied "Clear Buffer" SIE command to the bulk IN endpoint?
This command is supposed just for OUT endpoints.

CDC-ACM class driver on PC of major OS (Windows, Linux and MacOSX) always polls bulk IN pipe, regardless that PC application reads RX COM port or not. Therefore, when your firmware stops writing to the bulk IN endpoint, the bulk IN endpoint buffer goes empty within two or three USB frames, even considering of double buffering. You may confirm buffer empty, applying "Select Endpoint" SIE command, at B_1_FULL/B_2_FULL bits.

Rather, you have to flush the input buffer on the PC class driver.
For Windows, Win32 API: PurgeComm( PURGE_RXCLEAR ), .NET: SerialPort.DiscardInBuffer

Tsuneo
0 项奖励
回复