cancel
Showing results for 
Search instead for 
Did you mean: 

stm32g0b1 usb endpoint3 problem

zhuliangliang
Associate II

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.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

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. 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


View solution in original post

8 REPLIES 8
FBL
ST Employee

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.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


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

zhuliangliang_0-1755246580168.png

EP0 

FBL
ST Employee

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. 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


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.

 

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!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


Grant Bt
Senior II

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

Nellipatel
Associate

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.