|
aasi,following your suggest, I configure the ep2 and ep6 as below:
EP2CFG = 0xA2;// 1010 0010 valid out bulk 512 0 x2
EP6CFG = 0xE2; //valid in bulk 512 0 x2
I debug the code as you give, more problems happen.
e.g.
ep4 out 80(512bytes),81(512bytes),82(512bytes),83(512bytes),84(failed)--- why 4 times?
then ep8 in 80 to 7f (right); in again,81 to 80 then failed and out failed too.
that means the last 1024 bytes have strucked in buffer and I still can't get the latest data.
if I remain 512 bytes for ep4 (ep4 out 83(512bytes)after ep8 in instead before) ,the data in ep8 as above.
in my opinion, if there's not a instruction to clear ep4 buffer directly, to keep data in ep4 buffer newest is very hard, even impossible. by transmitting,only when old data transmit that I can get the newest.( I am not sure that is right or not)
another question, in this situation , need I configure ep4 and ep8 the same mode, both bulk or interrupt?
and what's the diffrence between " INPKTEND=0X88" and " INPKTEND=0X08"? the former firmware will skip ep8 and the latter will commit. but why when I read ep8, the frmer is failed and the latter return "0000"?
|