cancel
Showing results for 
Search instead for 
Did you mean: 

USB cdc, CDC_SET_LINE_CODING and CDC_GET_LINE_CODING

MK..1
Associate III

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

4 REPLIES 4
TDK
Guru

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
Associate III

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

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".
FBL
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!