Re: The missing piece: porting BPv4 to the open source USB s
Reply #16 –
I'm ashamed of you guys ;) You're both better coders than me, and more attentive :P I found the problem, and it was super amateur hour :D (just kidding about the shame part, ya'll are awesome!)
lock = 1;
*InPtr = c;
InPtr++;
CDC_In_count++;
if (CDC_In_count > 62) {//62
WaitInReady();
SendCDC_In_ArmNext(CDC_In_count);
FAST_usb_handler();
}
lock = 0;
//setup timer to throw data if the buffer doesn't fill
fcnt = 0;
Notice any glaring omission in this code? Here's a hint:
CDC_In_count=0;
Yes. That's right. The byte counter is never reset. Actually it is, but only in the interrupt service loop and not the main loop when there are lots of characters processed.
Here's the fix:
*InPtr = c;
InPtr++;
CDC_In_count++;
if (CDC_In_count > 62) {//62
WaitInReady();
SendCDC_In_ArmNext(CDC_In_count);
FAST_usb_handler();
CDC_In_count=0;
}
I'm going to test with bootloader and then upload a package to test.