Skip to main content
gbm
Super User

Use notification endpoint instead of command endpoint in all STM32 USB CDC ACM examples and reference guides

Split from this discussion STM32U575xx USBX CDC ACM only transmits less than 8 bytes | Community

It is NOT a real cause nor solution. The  USBD_CDCACM_EPINCMD_FS_MPS defines the size of a notification endpoint, incorrectly referred to as “command endpoint” in ST documents and code. The constant related to data In endpoint is USBD_CDCACM_EPIN_FS_MPS.

4 replies

ST Technical Moderator

Hi ​@gbm 

You are correct that USBD_CDCACM_EPINCMD_FS_MPS applies to the interrupt endpoint, while USBD_CDCACM_EPIN_FS_MPS applies to the data-IN bulk endpoint.

Could you please point me to the relevant USB CDC specification section describing the notification endpoint? I would like to align my terminology with the specification.

In my understanding, in CDC ACM, the interrupt IN endpoint carries SERIAL_STATE and so on; the bulk-IN and bulk-OUT endpoints carry serial data.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
gbm
gbmAuthor
Super User

@FBL: It’s an endpoint of interrupt type, used to send notifications from the CDC ACM device to the host. Contrary to what might be read in few ST comments related to USB device stack code, the endpoint is not used for sending any commands or command responses - these are handled via device’s main control endpoint (EP0). In particular, this endpoint is NOT used for GET_LINE_CODING nor SET_LINE_CODING CDC class requests.

Look here for an example - section 2.2 contains incorrect information on the notification endpoint:

Quote:

1 x interrupt IN endpoint: For setting and getting serial-port parameters. In this example, two requests can be implemented:

  • Set Line: Set the bit rate, number of stop bits, parity, and number of data bits.
  • Get Line: Get the bit rate, number of stop bits, parity, and number of data bits.
  • Other requests (send break, control line state) may be implemented.
My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
ST Technical Moderator

Sorry for late reply  ​@gbm and Thank you for your feedback, I fixed it, 

  • 1 × interrupt IN endpoint (also called notification endpoint): The STM32 device uses this endpoint to send CDC ACM notifications to the host.

    • Reports serial port status to the host. For example, if the UART detects a parity error, the STM32 can queue a SERIAL_STATE notification with the parity error bit set. The host receives the notification when it next polls the endpoint.

    • Default control endpoint (EP0): The host uses SET_LINE_CODING to set the bit rate, number of stop bits, parity, and number of data bits. It uses GET_LINE_CODING to read those settings back. Both requests and their responses use EP0, not the notification endpoint. Other supported requests, such as SET_CONTROL_LINE_STATE and SEND_BREAK, also use EP0.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
ST Technical Moderator

​@gbm  An internal ticket CDM0067950   is submitted to dedicated team to update references to command endpoint to notification endpoint in all STM32 USB CDC ACM examples.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL