STM32 i problem z wielkoscia bufora USB

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ę:

  1. więcej niż 64 bajty danych (data payload > 64) => mam błąd i będzie STALL
  2. mam 64 bajty danych (data payload = 64) => nie mam błędu, w buforze mam wszystkie 64 bajty
  3. mam 63 bajty danych (data payload = 63) => nie mam błędu, w buforze mam 63 bajty danych + 1 bajt CRC
  4. mam 62 lub mniej bajtów danych (data payload <= 62) => nie mam błędu, w buforze mam odebrane bajty danych + 2 bajty CRC

SM

Reply to
SM
Loading thread data ...

Skończyłem USB CDC sprawdziłem empirycznie. Jest OK. Procek odbiera pełną ramkę 64 bajtów i nie wyrzuca błędu że mu się dwa bajty CRC nie mieszczą.

Czy sprawa zamknięta.

SM

Reply to
SM

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.