2025-12-11 11:01 PM - last edited on 2025-12-15 2:22 AM by Andrew Neil
Hi, I’m trying to better understand how the USB PMA and BTABLE work on the STM32F103. After reading the reference manual, I’m still unsure how the descriptor table size relates to the number of endpoints.
I have two possible interpretations of how the USB Descriptor Table and PMA layout work on the STM32F103, and I need clarification from ST to confirm which one is correct.
I will provide two diagrams (Figure A and Figure B) to illustrate the scenario, assuming BTABLE offset = 0.
In this interpretation:
The USB descriptor table is always 8 × 8 bytes = 64 bytes (0x0000–0x003F), assuming the device supports 8 endpoints.
The usable PMA buffer area always starts at 0x0040, regardless of how many endpoints are actually used (for example, even if only 3 endpoints are used).
Therefore the usable PMA region would always be 0x0040–0x0200.
Question A:
Is this interpretation correct? Is the descriptor table size always fixed at 64 bytes in the STM32F103, independent of the number of endpoints actually used?
In this interpretation:
The BTABLE size depends on the number of endpoints used.
For example, if I use 4 endpoints:
4 × 8 bytes = 32 bytes → 0x0000–0x001F.
The PMA usable buffer area starts immediately after the descriptor table.
Example: 0x0020–0x0200.
Question B:
Is this interpretation instead the correct one? Does the size of the BTABLE section shrink or grow depending on how many endpoints are enabled in the firmware?
When BTABLE = 0x0000, does the usable PMA buffer area always begin at 0x0040,
or does it shift depending on how many endpoints are configured?
Thank you very much—I want to ensure I place my PMA buffer addresses correctly.
2025-12-15 2:11 AM
hello @rohamid
The usable PMA buffer area can begin at addresses lower than 0x0040. However, it is recommended to use address 0x0040 to avoid potential issues related to overlapping or tightly packed buffer regions.
You can review these articles: article 1 and article 2
I think you can find details that can be helpful for you there.
Gyessine
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.