I am having terrible trouble explaining (what I think is) a bug in Cypress'
software to their technical support. I fear others may have struggled too.
Perhaps there are other bugs and we are all wasting time finding them. At
least, I've not found anywhere where they are discussed and newly downloaded
code is old.
Anyway, for what it is worth, I believe:
if(GotSUD) // Wait for SUDAV
{
SetupCommand(); // Implement setup command
GotSUD = FALSE; // Clear SUDAV flag
}
is wrong as if there is an interrupt after the "EP0CS |= bmHSNAK;" at the
end of SetupCommand() and the PC is quick, it can send the next USB command
resulting in GotSUD being set (true), which is promptly lost. The fix is
trivial:
if(GotSUD) // Wait for SUDAV
{
GotSUD = FALSE; // Clear SUDAV flag
SetupCommand(); // Implement setup command
}
I grant you it is not a big problem, but why is it so hard for them to
recognise it, and why is there no process for publishing such things?
I have found other possible errors in the sample code.
Rgds,
Bill