Skip to main content
Marina Brener
Associate III
November 7, 2017
Question

STM32H743 nucleo won't work in USB OTG FS

  • November 7, 2017
  • 5 replies
  • 5890 views
Posted on November 07, 2017 at 10:49

Hello,

I am working on a STM32H743 – NUCLEO 144 and need to use OTG_FS device only option in CDC mode.

I generated a project using the stm32cubeMX and have defined:

  1. SYS – Time bases : TIM1
  2. USB DEVICE – class for FS IP: CDC
  3. USB_OTG_FS - device only, VBUS – disabled
  4. The clock is configured from RC48 to USB
  5. Last cube version – 4.23

Found 2 problems:

  1. The device won’t enumerate as a serial com port and I cannot see it as unknown device as well (I am talking about CN13).
  2. The interrupt OTG_FS_Handler, never fires. So nobody raises HAL_PCD_IRQHandler.

As a test, same steps (using the cube) were applied on STM32L496 – nucleo, the L4 board enumerates and works properly as usb OTG.

Did someone encountered these problems on STM32H7?

What am I missing?

Amann.Joerg

, I saw your question about the stm32H743 USB, did you manage to run the OTG FS CDC mode?

Thanks for the help!

null
    This topic has been closed for replies.

    5 replies

    jamann
    Associate II
    November 7, 2017
    Posted on November 07, 2017 at 10:58

    Yes , working without a problem. 

    Marina Brener
    Associate III
    November 7, 2017
    Posted on November 07, 2017 at 17:02

    Thanks for the fast response, glad to hear that it is working for you! 

    I downloaded your project for reference, the device is still not enumerated. 

    I saw you defined a HSE clock, did you add an external crystal source to the nucleo board? Any additional changes you made?

    Also, I saw a functions called

    HAL_PWREx_EnableUSBReg(), HAL_PWREx_EnableUSBVoltageDetector() in this file stm32h7xx_hal_pwr_ex.h. 

    D

    id anybody use them? 

    Thanks a lot!

    ST Technical Moderator
    November 16, 2017
    Posted on November 16, 2017 at 15:45

    Hello

    marina.brener

    ,

    Please add HAL_PWREx_EnableUSBVoltageDetector function call to usb_device.c file. This may resolve your problem.

    Best Regards

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    KVija
    Associate II
    October 5, 2018

    Hi All,

    Thanks for all your inputs. i have fixed this issue and place in the attachment, Find the fixes in readme file.

    AAnt.1
    Associate II
    May 3, 2021

    Hi @KVija​  your code work! Thank for it !

    I decided to change speed of bitrate for data that transferd, but could,n to see that in code .

    Show me, please, place in your code, where i could change bitrate for VCP from 115200 to maximal, like 921300.

    Best regards.

    Torsten Jaekel
    Associate III
    May 3, 2021

    Not sure, about which USB VCP we are talking:

    1. The VCP on the ST-LINK debug/power port, which comes from the external chip, via regular UART to the STM MCU: here, it is for instance a UART1 - you have to change the bit rate on the UART1 configuration.
    2. If you ask about the 'native' USB VCP, using the USB stack, with the USB enumerator etc.: actually, you do not need really to change anything, it is 'agnostic' to the bit rate (change it in your host terminal application, e.g. TeraTerm). The USB descriptors do not contain a specification for the bit rate, format (number of bits, parity). Instead, it is a control message coming via USB after the enumeration (see code piece below.

    For a "full", native USB VCP (e.g. via the USR USB port):

     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];
     
     /* Add your code here */
     break;
     
     case CDC_GET_LINE_CODING:
     pbuf[0] = (uint8_t)(linecoding.bitrate);
     pbuf[1] = (uint8_t)(linecoding.bitrate >> 8);
     pbuf[2] = (uint8_t)(linecoding.bitrate >> 16);
     pbuf[3] = (uint8_t)(linecoding.bitrate >> 24);
     pbuf[4] = linecoding.format;
     pbuf[5] = linecoding.paritytype;
     pbuf[6] = linecoding.datatype;
     
     /* Add your code here */
     break;
     

    You have just to remember what was requested, in order to return it. Or, you could to something with the info. But the data transfer, the VCP bit rate is actually any possible via the type of USB (FS, HS).

    If it is the VCP on Debug/Power port - it goes via a real UART, from/to external chip and you had to change your UARTx configuration.

    CChen.11
    Visitor II
    December 6, 2018

    Blocked by this bug for couple days until I found this thread. Great job guys!

    Volker Bremauer
    Associate II
    January 16, 2020

    Thank's so much, had the same problem.

    :grinning_face:

    jamann
    Associate II
    May 3, 2021
    mute
    Am 03.05.21 um 20:40 schrieb ST Community: