Skip to main content
Explorer
August 14, 2025
Solved

stm32g0b1 usb endpoint3 problem

  • August 14, 2025
  • 4 replies
  • 507 views

Hello,

I'm using STM32G0B1RCT6 

use cubemx generate cdc project works ok

but when I edit  endpoint to 0x03 it Not working properly

zhuliangliang_1-1755154021745.png

 

zhuliangliang_0-1755153981355.png

USB packet capture  endpoint 0x03   returns stall

 

ny Idea about this issue and how to fix it please?

Thanks.

 

 

 

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

    Hi @zhuliangliang 

    Thank you for your feedback!

    I assume, in this project you are not affecting EP1 and EP1 to any Tx or Rx FIFO which is not expected from the stack. I assume you can't skip EP1 and EP2 and configure only EP3. Using our current stack, it can cause USB peripheral misbehavior. You need to ensure PMA addresses do not overlap and are properly aligned. 

    4 replies

    Technical Moderator
    August 14, 2025

    Hi @zhuliangliang 

    You need to be careful not to overlap one fifo with another, otherwise you will get unexpected behavior.

    Do you have over endpoints to be configured ? Share with me EP0 configuration as well to provide a working configuration. 

    Soon we will provide an article about how to configure packet memory area.

    Explorer
    August 14, 2025

    I am using the demo generated by cubemx, but I have only modified the endpoint because I need to use endpoint 3 in other projects. This is just a test, but it doesn't work. I don't know what the problem is

    FBLAnswer
    Technical Moderator
    August 15, 2025

    Hi @zhuliangliang 

    Thank you for your feedback!

    I assume, in this project you are not affecting EP1 and EP1 to any Tx or Rx FIFO which is not expected from the stack. I assume you can't skip EP1 and EP2 and configure only EP3. Using our current stack, it can cause USB peripheral misbehavior. You need to ensure PMA addresses do not overlap and are properly aligned. 

    Graduate II
    August 15, 2025

    I assume you can't skip EP1 and EP2 and configure only EP3. Using our current stack, it can cause USB peripheral misbehavior.

    I hope this is documented elsewhere. I can't say I would do this myself (use EP3 without EP1/EP2 or use EP2 without EP1), but I could see someone try.

     

    Technical Moderator
    August 29, 2025

    Hi @zhuliangliang @Grant Bt 

    When selecting endpoint x (EPx) directly, the user must ensure that memory space is also allocated for the descriptors and buffer areas of the preceding endpoints (e.g., EP(x-1) .. EP1) to avoid overlapping in the Packet Memory Area (PMA). Note that each endpoint descriptor occupies 7 bytes in the USB descriptor table. New article will be pushed soon on ST community explaining this!

    Graduate II
    August 29, 2025

    If you remember, please post a link to that new article when it becomes available.

    Explorer
    August 31, 2025

    It looks like the issue is with the endpoint configuration. On STM32 CDC projects, usually endpoint 1 IN/OUT and endpoint 2 IN are enabled by default. If you change the endpoint to 0x03, you also need to update the endpoint definitions in both usbd_cdc.c and the USB descriptor file.

    Make sure that:

    • The endpoint address matches its type (IN or OUT)

    • The USB descriptor and the USBD_LL_OpenEP() function call are updated consistently

    • The host application is actually requesting data on that endpoint

    If there is any mismatch between the descriptor and the firmware, the USB core will return a STALL, which is why you are seeing this issue.