Skip to main content
MK..1
Associate III
August 1, 2024
Question

USB cdc, CDC_SET_LINE_CODING and CDC_GET_LINE_CODING

  • August 1, 2024
  • 2 replies
  • 1583 views

Hi

the USB tutorial of ST is a bit outdated. Do I still need to do the loop back of line coding in usbd_cdc_if.c in function CDC_Control_HS? I am using Stm32f4 and STM32Cube FW_F4 V1.28.0

This is mentined in this video:

https://youtu.be/h9T0RTu9Muc?list=PLnMKNibPkDnFFRBVD206EfnnHhQZI4Hxa&t=1702

Thx

2 replies

TDK
August 1, 2024

In general, yes, although the answer will depend on the terminal software. Some of them don't care, some of them need you to return the same settings it sent to you.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
MK..1
MK..1Author
Associate III
August 1, 2024

I am using python actually. Do you think it will matter with different python versions? Or on Linux/mac?

TDK
August 1, 2024

Yes, I do think it will matter.

And it's easy to do, so do it. That way you don't have to guess.

"If you feel a post has answered your question, please click ""Accept as Solution""."
ST Technical Moderator
August 2, 2024

Hi @MK..1 

Here is another implementation to set LineCoding function 

 case CDC_SET_LINE_CODING:
 LineCoding.bitrate = (uint32_t)(pbuf[0] | (pbuf[1] << 8) |\
 (pbuf[2] << 16) | (pbuf[3] << 24));
 LineCoding.format = pbuf[4];
 LineCoding.paritytype = pbuf[5];
 LineCoding.datatype = pbuf[6];

 

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