Skip to main content
Explorer
August 1, 2024
Question

USB cdc, CDC_SET_LINE_CODING and CDC_GET_LINE_CODING

  • August 1, 2024
  • 2 replies
  • 1578 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

    This topic has been closed for replies.

    2 replies

    Super User
    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.

     

    MK..1Author
    Explorer
    August 1, 2024

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

    Super User
    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.

    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];