AnsweredAssumed Answered

USB FS setup packets and buffer overrun

Question asked by shibakov.alex on Jul 16, 2012
Latest reply on Jul 17, 2012 by shibakov.alex
Hi all!

I have two questions on how to interpret the documentation for the USB FS device macrocell in medium density devices.

1. The section on OUT transactions states that when a buffer is overrun (i.e. the data payload is longer than the allocated length of the buffer in the PMA) no interrupt is generated. There is some wording to the effect that SETUP transactions are handled `similarly', however, when I deliberately set the buffer to, say, 2 bytes, an interrupt is still generated,  only 2 bytes are written into the buffer, and the length of the packet is reported as 0. Is this the correct behavior according to the docs? I think the description of OUT and SETUP transactions should be more precise.

2. The same section mentions that in the case of a successful SETUP/OUT transaction, the buffer is written for the number of bytes equal to the length of the packet, CRC included (i.e. data payload + 2). It is careful enough NOT to say that the extra 2 bytes are actually the CRC of the data payload but does not mention what they are. In my experience those data bytes are not the CRC (the two bytes are always identical, for starters which makes me think they are the result of an 8-bit access on the APB1 bus), so what are they? Also, if I set the buffer length to exactly 8 bytes (the length of the data payload WITHOUT the CRC) then everything goes according to the manual and NO extra bytes are written and no overrun condition or any other errors are reported. Why are these bytes written in the first place?