Skip to main content
Visitor II
December 23, 2023
Question

stm32f411c - No VCP-acceptance - usart2 initialisation under linux ...

  • December 23, 2023
  • 7 replies
  • 2271 views

Good Morning,

 

 

when I use the following short function for initialisation - no VCP is detected under Linux:

 

 

 

void USART2_Init(void){

RCC->APB1ENR|=RCC_APB1ENR_USART2EN;

RCC->AHB1ENR|=RCC_AHB1ENR_GPIOAEN;

... ?!?!

GPIOA->AFR[0]=0x0700;

GPIOA->MODER|=(1<<5);

GPIOA->MODER&=~(1<<4);

USART2->BRR = 0x0681;

USART2->CR1 |=0x2008;

}

 

 

Is it a RCC reset register issue?

 

 

Best regards

TIMBO

    This topic has been closed for replies.

    7 replies

    Super User
    December 23, 2023

    VCP is a function on an USB device, so which device you use to do this ?

    +

    Just enabling an uart on a cpu : where you connected the uart lines rx/tx to ?

    timbo2023Author
    Visitor II
    December 23, 2023

    USB

    +

    Which uart I must enable in look to

    USART2->CR1 |=0x2008;

    , too?

    Super User
    December 23, 2023

    You giving no information - so what kind of help you expect ?

    F411 ...

    - what board ?

    USB device, so which device you use ?

    - where you connected the uart lines rx/tx to ?

    timbo2023Author
    Visitor II
    December 23, 2023

    VCP was not recognized - I must enable tx line - but how can I reach further informations regarding it?

    timbo2023Author
    Visitor II
    December 23, 2023

    Should I set a flag?

    timbo2023Author
    Visitor II
    December 23, 2023

    SR or CR1?

    Graduate II
    December 23, 2023

    What board are you using, provide link to vendor website or picture.

    There's a USB connector on this board?

    UARTs don't magically provide USB or VCP connections by themselves. 

    For a standalone chip you'd need to code a USB Device using the CDC/VCP Class to be recognized.

    For a NUCLEO or DISCO board the ST-LINK might provide a VCP for the target STM32

    timbo2023Author
    Visitor II
    December 23, 2023

    WeAct Black Pill V3.0

     

    I thought it must be only a flag setting contextual...

    Graduate II
    December 23, 2023

    The USB here connects directly to the STM32F411. To have it appear as a VCP you will need software on it that presents as a USB CDC Class Device.

    Simply enabling a UART doesn't do that. That will provide pin level serial output, that's all.