Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[teensy4] Why are the same USB endpoints used for both RX & TX #769

Open
forderud opened this issue Oct 7, 2024 · 0 comments
Open

[teensy4] Why are the same USB endpoints used for both RX & TX #769

forderud opened this issue Oct 7, 2024 · 0 comments

Comments

@forderud
Copy link

forderud commented Oct 7, 2024

The teensy4 usb_desc.h contain a mix of configurations where the same USB endpoint number is used for both transmit & receive for a given interface, and configurations where different endpoint numbers are used. The former puzzles me, since I though USB data endpoints were supposed to be unidirectional.

Some examples of same endpoint numbers:

  • USB_DUAL_SERIAL defines both CDC_RX_ENDPOINT and CDC_TX_ENDPOINT to 3.
  • USB_DUAL_SERIAL defines both CDC2_RX_ENDPOINT and CDC2_TX_ENDPOINT to 5.
  • USB_KEYBOARDONLY defines both SEREMU_TX_ENDPOINT and SEREMU_RX_ENDPOINT to 2.
  • USB_MIDI defines both SEREMU_TX_ENDPOINT and SEREMU_RX_ENDPOINT to 2.
  • USB_MIDI defines both MIDI_TX_ENDPOINT and MIDI_RX_ENDPOINT to 3.
  • USB_FLIGHTSIM defines both FLIGHTSIM_TX_ENDPOINT and FLIGHTSIM_RX_ENDPOINT to 3.

It seems endpoint number reuse is enabled by a bEndpointAddress =| 0x80 in the USB configuration descriptor, which increases the actual endpoint number by 128.

Some examples of different endpoint numbers:

  • USB_SERIAL defines CDC_RX_ENDPOINT to 3 and CDC_TX_ENDPOINT to 4.
  • USB_RAWHID defines RAWHID_TX_ENDPOINT to 3 and RAWHID_RX_ENDPOINT to 4.
  • USB_EVERYTHING contains a commented-out MTP_TX_ENDPOINT define to 11 and MTP_RX_ENDPOINT define to 3.

Could it make sense to either always use the same endpoint number for TX & RX, or always use different numbers?

some exam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant