Flushing EP2IN on MAX3421E and WinUSB

In my project I sometimes read a stream of data from a device attached to a MAX3421E. That part has a couple of 64 bytes FIFO's, and when they are empty, I fill them again, and lovely data rates.

All is well UNTIL I want to stop the stream, and read something else. The

2*64 bytes gets prefixed to the next thing I read.

Reading the data does not work as the CPU driving the MAX3421E obligingly fills the FIFO's up again.

What I want to do is:

a) Send vendor specific command to start stream operation

b) Read loads of data

c) Send vendor specific command to stop stream operation (stops filling EP2IN any more but there are 2*64 bytes up the spout)

c) Do something at the PC end to get rid of those bytes.

e) Send vendor specific command to start next operation

Is there anyway the MAX3421E can empty the EP2INFIFO's in step c?

What is the "right" way of doing step d? I have tried an assortment of flushing, aborting, and resetting EP2IN at the PC end of things.

TIA,

Bill

Reply to
Bill Davy
Loading thread data ...

Bill,

So you are using the MAX3421E in peripheral mode.

You could try setting STALL on EP2 from PC then clearing it. This should force the MAX3421E to reset that endpoint.

Andrew

Reply to
Andrew Jackson

Many thanks Andrew. I'll try that. Any idea how to stall an EP using WinUSB? Rgds, Bill

Reply to
Bill Davy

Bill

Send a control request: SetFeature(EndpointHalt) followed by a ClearFeature(EndpointHalt). Both requests should be directed to the appropriate endpoint.

Andrew

Reply to
Andrew Jackson

Excellent. Thank you. Bill

Reply to
Bill Davy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.