Incorrect value for STM32F103 processors - TUP_DCD_ENDPOINT_MAX
Operating System
Linux
Commit SHA
1
Board
Any board using STM32F103xB
Firmware
TinyUSB asserts when trying to open a USB endpoint with address 08.
What happened ?
In STM32 USB endpoint values are 4 bit, with values 0 - 15.
tusb_mcu.h defines TUP_DCD_ENDPOINT_MAX as 8 which is incorrect. It should be 16.
How to reproduce ?
Try and open an endpoint address >= 0x08, e.g. 0x88 and usbd.c will assert at approx line 1360. for example #define EPNUM_CDC_3_NOTIF 0x87 #define EPNUM_CDC_3_OUT 0x08 #define EPNUM_CDC_3_IN 0x88 TUD_CDC_DESCRIPTOR(ITF_NUM_CDC_3, 6, EPNUM_CDC_3_NOTIF, 8, EPNUM_CDC_3_OUT, EPNUM_CDC_3_IN, 8)
Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)
Patched in a printf to confirm the failure I was getting.... Below is the trace using CFG_TUSB_DEBUG = 3.
Open EP 87 with Size = 8 CFG_TUD_ENDPPOINT_MAX 8 bEndpointAddress 08 usbd_edpt_open 1361: ASSERT FAILED
Screenshots
No response
I have checked existing issues, discussion and documentation
- [x] I confirm I have checked existing issues, discussion and documentation.
hw only support up to 8 endpoints, can you use the number 1-7 instead ?
I would like to point out that the number of hw endpoint registers has nothing to do with the values of an endpoint address. They are two separate things, e.g. a single hw endpoint register can hold any endpoint address in the range 0 - 15.
we know, but atm we don't have plan/motivation to implement that since user can simply use the number 1-7 instead.