Skip to main content
Visitor II
November 25, 2025
Solved

Please bring back old USB middleware

  • November 25, 2025
  • 7 replies
  • 303 views

Hello, STM employees,

I have bought the NUCLEO-N657X0 board with the intentions of using its USB on the go module. I have previous experience with USB with STM32f401, where I had to employ a single function CDC_Transmit(), and STM32CubeIde and Hal did the rest. It was simple and easy to implement. Currently Im struggling with doing the same with the N6 MCU, but proved impossible. I've tried all tutorials found on your site and community available ones, but could not find a single example that would send "Hello World!" to my PC. I'm sure my board works as I've run a basic blink sketch from the external ROM.

Please, if you could add the same middleware for f401 to n657, that would be great. 

    This topic has been closed for replies.
    Best answer by bleqy

    I managed to make it work, using the CDC UART-bridge example,
    by replacing the original code for usbx_cdc_acm_write_thread_entry() with the following:

    VOID usbx_cdc_acm_write_thread_entry(ULONG thread_input){

    static CHAR msg[] = "Hello world!\r\n";

    ULONG sent;

    while (1){

    if (cdc_acm != UX_NULL)){

    ux_device_class_cdc_acm_write(cdc_acm, (UCHAR*)msg, sizeof(msg) - 1, &sent);

    }

    HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_0);

    tx_thread_sleep(100); // send every ~100ms

    }

    }

    But still, I need to know what went wrong with the classic CDC example.

    7 replies

    Technical Moderator
    November 25, 2025

    hello @bleqy 
    I am sorry to hear about your struggles.
    Did you try to run our firmware examples?
    Here is a CDC_ACM
    firmware example. You just need to compile and run it.
    You can exploit it to better understand how the USBX middleware works.

    Hope that helps.
    Gyessine

    Technical Moderator
    November 25, 2025

    Hello @bleqy 

    About classic ST library I would add and recommend the following example from the classic core MW repository.

    bleqyAuthor
    Visitor II
    December 6, 2025

    Hello,

    I'm currently working with the classic core MW repository. There is a problem. In the function USBD_LL_Init(), in usbd_conf.c , there are functions that are not compliant to STM32N6 like HAL_PCDEx_PMAConfig. How do I replace them. This is the only error, that I get from the IDE. Also, there are some definitions from the example like PCD_SNG_BUF and CDC_IN_EP that are not defined anywhere. Can you help?


    Thanks

    Technical Moderator
    December 8, 2025

    hello @bleqy 
    can you please share with us a caption of the problems window from your CubeIDE to see the full error that you are getting?

    Gyessine

    bleqyAuthor
    Visitor II
    December 8, 2025
    bleqyAuthorAnswer
    Visitor II
    December 8, 2025

    I managed to make it work, using the CDC UART-bridge example,
    by replacing the original code for usbx_cdc_acm_write_thread_entry() with the following:

    VOID usbx_cdc_acm_write_thread_entry(ULONG thread_input){

    static CHAR msg[] = "Hello world!\r\n";

    ULONG sent;

    while (1){

    if (cdc_acm != UX_NULL)){

    ux_device_class_cdc_acm_write(cdc_acm, (UCHAR*)msg, sizeof(msg) - 1, &sent);

    }

    HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_0);

    tx_thread_sleep(100); // send every ~100ms

    }

    }

    But still, I need to know what went wrong with the classic CDC example.

    Technical Moderator
    December 10, 2025

    Hello @bleqy 

    >there are functions that are not compliant to STM32N6 like HAL_PCDEx_PMAConfig. 

    About that, STM32N6 unlike the STM32F4 you used to work with is not embedding USB device controller to use Packet Memory Area! The STM32N6 embeds USB OTG controller. So we use FIFOs instead of PMA.

    To learn more refer to these articles:

    How to configure USB FIFO over USB OTG controller

    How to configure the packet memory area in STM32

    About 

    > But still, I need to know what went wrong with the classic CDC example.

    If still having issues, I suggest you to start a new discussion and point directly to the issue and provide better about your application (HW and SW) so we can help you further.