Receive

USB CDC Receive block

This block supports USB Device CDC FS/HS interface on STM microcontrollers.

Contents

Block parameters for USB FS and HS interface

  • USB type – switch between USB FS and HS
  • Receive mode – (only support Binary mode)
  • Header settings->Hex format – supports hex format of header
  • Header settings->Length – length of hex header in bytes (only for hex format enabled)
  • Header settings->Header – header of frame (e.g. ‘START’ in non hex format and e.g ‘0x53 0x54 0x41 0x52 0x54’ for hex format of header
  • Data settings->Output data type – output buff of data type
  • Data settings->Max data length – max data length of one frame in bytes
  • Data settings->Max receive frames – max of receive frames in one time
  • Terminator settings->Enable – enable search terminator
  • Terminator settings->Hex format – supports hex format of terminator
  • Terminator settings->Length – length of hex terminator in bytes (only for hex format enabled)
  • Terminator settings->Terminator – terminator of frame (e.g. ‘END’ in non hex format and e.g ‘0x45 0x4E 0x44’ for hex format of terminator
  • Sample time – period of function refreshing (-1 means that a particular block takes sample time from its input block or if it doesn’t have any input block it takes the fastest sample time in a model)

Settings for STM32H7 USB FS and HS

  • Set USB CDC Setup block first

Comments

  • For use USB CDC Receife block in FS add “USB_CDC_Read_Buff(&hUsbDeviceFS, Buf, Len);” in function CDC_Receive_FS in file usbd_cdc_if.c:
  • For use USB CDC Receife block in HS add “USB_CDC_Read_Buff(&hUsbDeviceHS, Buf, Len);;” in function CDC_Receive_HS in file usbd_cdc_if.c: