USB multi-serial using few endpoints?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

TL;DR: I'm looking for a USB-to-multi-serial solution that uses as few
USB endpoints as possible.  Anyone with a good suggestion?

Full description:

I have a board farm that is controlled by a single BeagleBone Black.
Serial consoles are connected to the boneblack using USB: most
contemporary boards have on-board USB serial console (cp210x/ftdi_sio/
cdc_acm), some still rely on external USB-to-serial convertors.
I also have a USB webcam, to keep an eye on a board's display.
For power control, I use BayLibre ACME[1].
As I ran out of channels on the ACME, I designed my own board[2] to add
more power channels, including two serial ports and opto-isolated
outputs.  Each bcu2 board has a Teensy 3.2, which connects to the
boneblack using USB, providing 3 USB-serial ports (one interactive
control channel, two for the two physical serial ports, using cdc_acm).

Unfortunately the musb USB host controller on am335x is limited to 16
endpoints.  If no free endpoint is available, the dreaded

    musb-hdrc musb-hdrc.1: int hwep alloc failed for 1x1

message is printed (only on v4.13 and newer).
As I understand EP0 and EP1 are reserved, and one extra endpoint is
reserved for multiplexing bulk transfers, this means 13 endpoints are
available for "locked" use by drivers.

By looking at bNumEndpoints in the lsusb output, and by adding debug
code to the musb_host driver, I derived the following endpoint use by
various usb drivers:
  - cp210x: 2 endpoints per serial port (1 locked when in use),
  - ftdi_sio: 2 endpoints per serial port (1 locked when in use),
  - cdc_acm: 3 endpoints per serial port (2 locked when in use),
  - mos7840: 9 endpoints for 4 serial ports (up to 4 locked when in use),
  - spca561: 1 endpoint per camera (1 locked when in use).

As you see, cdc_acm seems to be the worst way to provide a USB serial
port, as each port needs 2 "locked" endpoints.  That means each bcu2
board needs 6 locked endpoints, and I cannot use (at the same time) more
than 2 bcu2 boards connected to a single boneblack.

While I cannot replace USB-serial convertors on development boards, I
can replace the USB serial implementation on the Teensy.  Hence I'm
looking for a more efficient USB-multi-serial protocol (preferably one
that has a Linux driver), using as few endpoints as possible.
I'm not a USB expert, but If I'm not mistaken, an N-port
USB-multi-serial adapter could be implemented using only 2 or 3
endpoints (one "locked" input endpoint for signalling, and one (TX/RX
combined) or two (TX and RX separated) multiplexed endpoints for data)?

If no such thing exists, I guess I can use the mos7840 protocol instead?
Or is there a better solution?

Thanks for your comments!

[1] https://baylibre.com/acme/
[2] https://github.com/geertu/pcb-bcu2

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux