Witam,
Wróciłem do zabawy z STM32F103. Kończę swoją obsługę USB i trafiłem w PDFie Referene Manual RM0008 do STM32F... na takie zdanie:
"Reception memory buffer locations are written starting from the address contained in the ADDRn_RX for a number of bytes corresponding to the received data packet length, CRC included (i.e. data payload length + 2), or up to the last allocated memory location, as defined by BL_SIZE and NUM_BLOCK, whichever comes first. In this way, the USB peripheral never writes beyond the end of the allocated reception memory buffer area. If the length of the data packet payload (actual number of bytes used by the application) is greater than the allocated buffer, the USB peripheral detects a buffer overrun condition. in this case, a STALL handshake is sent instead of the usual ACK to notify the problem to the host, no interrupt is generated and the transaction is considered failed."
Czy z tego mogę wnioskować, że jeśli mam bufor odbioru danych o wielkości 64 bajty (zdefiniowane poprzez BL_SIZE i NUM_BLOCK), to gdy odbiorę:
- więcej niż 64 bajty danych (data payload > 64) => mam błąd i będzie STALL
- mam 64 bajty danych (data payload = 64) => nie mam błędu, w buforze mam wszystkie 64 bajty
- mam 63 bajty danych (data payload = 63) => nie mam błędu, w buforze mam 63 bajty danych + 1 bajt CRC
- mam 62 lub mniej bajtów danych (data payload <= 62) => nie mam błędu, w buforze mam odebrane bajty danych + 2 bajty CRC
SM