¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

USB experts? Question about serial devices, implementing multiple ports on QDX


 

Hi all

So there was some discussion here about implementing a second serial port on QDX. This would allow some configuration and monitoring activities to take place on one serial port connected to a terminal emulator, while another serial port is connected to WSJT-X for CAT control.?

Implementing a second serial port using microcontroller UARTs is a relatively straightforward proposition however, less useful than it would be to be able to have TWO serial ports across the USB cable. However, resource constraints mean that it appears difficult, perhaps impossible, to support TWO serial ports on USB - that's why I am asking if there are any USB experts on here.?

Details - the serial port is the Communications Device Class Abstract Control Model (CDC ACM). The STM32F401 used has a USB peripheral supporting 4 pairs of endpoints. For non-USB experts... endpoints are like a USB communication channel between the PC and the device. In QDX these are used as follows:

0: USB control endpoint - this is always endpoint zero in any USB system
1: CDC Data in/out endpoint pair
2: CDC Command endpoint
3: Audio in/out endpoint pair

The Composite device (thought of like a USB Hub) layer sits above that but does not use up any endpoints itself, it's just a wrapping.

Since the STM32F401 has 4 pairs of endpoints and these are all used, it appears that implementation of a second serial port is impossible. But the world is full of tricks. There could be ways. Does anybody know? It is nice to dream that there might be some way to hack around in the code in the lowest layers of USB code and somehow fake something to look like there are more endpoints than there really are??

73 Hans G0UPL


 

Hi Hans,?
just an observation¡­you kinda already have done this on the QLG2 gps module haven¡¯t you? ?a USB serial port and the gps data out (TTL) that I just recently ran a bluetooth serial dongle to. Maybe a bit of external interfacing might get around the requirement?

73 Ken g4apb?


 

Hello Ken

> just an observation¡­you kinda already have done this on the?
> QLG2 gps module haven¡¯t you? ?a USB serial port and the?
> gps data out (TTL) that I just recently ran a bluetooth serial?
> dongle to. Maybe a bit of external interfacing might get?
> around the requirement?

Yes, the QLG2 implements a USB <-> Serial converter. Which you can use either for GPS data, or for any other purposes. So a QLG2 could be used as a converter for a QDX additional serial port implemented as a UART. That's a plan B. But it's not as attractive as being able to connect two serial devices to two QDX serial ports over the same existing USB cable we have now.?

73 Hans G0UPL



On Wed, Aug 24, 2022 at 9:25 AM KEN G4APB <lfoofui.nbz42@...> wrote:

Hi Hans,?
just an observation¡­you kinda already have done this on the QLG2 gps module haven¡¯t you? ?a USB serial port and the gps data out (TTL) that I just recently ran a bluetooth serial dongle to. Maybe a bit of external interfacing might get around the requirement?

73 Ken g4apb?


 

¿ªÔÆÌåÓý

Two ideas, both software heavy.

  1. Stop using CDC and write your own custom protocol. You can then multiplex as many channels of data as you want over a single pipe. You'll need to write a driver for the QDX end and Linux/Windows/Mac that handles the comms and audio as a composite driver and on the host computer split the multiplexed data out and fake the COM ports so application software can see the COM ports and use them.
  1. Stay using CDC but again multiplex the data over the signal channel. At the host you'll need to write something that takes data from the CDC COM port and demultiplexes it and then fake the extra COM ports for applications to use.

Option 2 sounds easier to me but still quite some work.

Andy



From: [email protected] <[email protected]> on behalf of Hans Summers <hans.summers@...>
Sent: Tuesday, August 23, 2022 10:48 PM
To: [email protected] Notification <[email protected]>
Subject: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
?
Hi all

So there was some discussion here about implementing a second serial port on QDX. This would allow some configuration and monitoring activities to take place on one serial port connected to a terminal emulator, while another serial port is connected to WSJT-X for CAT control.?

Implementing a second serial port using microcontroller UARTs is a relatively straightforward proposition however, less useful than it would be to be able to have TWO serial ports across the USB cable. However, resource constraints mean that it appears difficult, perhaps impossible, to support TWO serial ports on USB - that's why I am asking if there are any USB experts on here.?

Details - the serial port is the Communications Device Class Abstract Control Model (CDC ACM). The STM32F401 used has a USB peripheral supporting 4 pairs of endpoints. For non-USB experts... endpoints are like a USB communication channel between the PC and the device. In QDX these are used as follows:

0: USB control endpoint - this is always endpoint zero in any USB system
1: CDC Data in/out endpoint pair
2: CDC Command endpoint
3: Audio in/out endpoint pair

The Composite device (thought of like a USB Hub) layer sits above that but does not use up any endpoints itself, it's just a wrapping.

Since the STM32F401 has 4 pairs of endpoints and these are all used, it appears that implementation of a second serial port is impossible. But the world is full of tricks. There could be ways. Does anybody know? It is nice to dream that there might be some way to hack around in the code in the lowest layers of USB code and somehow fake something to look like there are more endpoints than there really are??

73 Hans G0UPL


 

Hello Andy

Yes, both ideas would work BUT both would stray away from one of the core principles of QDX: which is that I would use existing USB device drivers so that no special software or drivers would be needed on USB for the user to install. I think it would be a non-starter because the disadvantages would outweigh the somewhat tenuous advantages...

73 Hans G0UPL



On Wed, Aug 24, 2022 at 9:55 AM Andy <mm0fmf@...> wrote:
Two ideas, both software heavy.

  1. Stop using CDC and write your own custom protocol. You can then multiplex as many channels of data as you want over a single pipe. You'll need to write a driver for the QDX end and Linux/Windows/Mac that handles the comms and audio as a composite driver and on the host computer split the multiplexed data out and fake the COM ports so application software can see the COM ports and use them.
  1. Stay using CDC but again multiplex the data over the signal channel. At the host you'll need to write something that takes data from the CDC COM port and demultiplexes it and then fake the extra COM ports for applications to use.

Option 2 sounds easier to me but still quite some work.

Andy



From: [email protected] <[email protected]> on behalf of Hans Summers <hans.summers@...>
Sent: Tuesday, August 23, 2022 10:48 PM
To: [email protected] Notification <[email protected]>
Subject: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
?
Hi all

So there was some discussion here about implementing a second serial port on QDX. This would allow some configuration and monitoring activities to take place on one serial port connected to a terminal emulator, while another serial port is connected to WSJT-X for CAT control.?

Implementing a second serial port using microcontroller UARTs is a relatively straightforward proposition however, less useful than it would be to be able to have TWO serial ports across the USB cable. However, resource constraints mean that it appears difficult, perhaps impossible, to support TWO serial ports on USB - that's why I am asking if there are any USB experts on here.?

Details - the serial port is the Communications Device Class Abstract Control Model (CDC ACM). The STM32F401 used has a USB peripheral supporting 4 pairs of endpoints. For non-USB experts... endpoints are like a USB communication channel between the PC and the device. In QDX these are used as follows:

0: USB control endpoint - this is always endpoint zero in any USB system
1: CDC Data in/out endpoint pair
2: CDC Command endpoint
3: Audio in/out endpoint pair

The Composite device (thought of like a USB Hub) layer sits above that but does not use up any endpoints itself, it's just a wrapping.

Since the STM32F401 has 4 pairs of endpoints and these are all used, it appears that implementation of a second serial port is impossible. But the world is full of tricks. There could be ways. Does anybody know? It is nice to dream that there might be some way to hack around in the code in the lowest layers of USB code and somehow fake something to look like there are more endpoints than there really are??

73 Hans G0UPL


 

¿ªÔÆÌåÓý

Indeed. Moving from the standard drivers is a serious move that will open up lots and lots of "opportunities" that you don't want to have to debug and support! It's way of doing what your want, but fraught with issues.? A last resort probably.

Andy


From: [email protected] <[email protected]> on behalf of Hans Summers <hans.summers@...>
Sent: Wednesday, August 24, 2022 12:14 AM
To: [email protected] <[email protected]>
Subject: Re: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
?
Hello Andy

Yes, both ideas would work BUT both would stray away from one of the core principles of QDX: which is that I would use existing USB device drivers so that no special software or drivers would be needed on USB for the user to install. I think it would be a non-starter because the disadvantages would outweigh the somewhat tenuous advantages...

73 Hans G0UPL



On Wed, Aug 24, 2022 at 9:55 AM Andy <mm0fmf@...> wrote:
Two ideas, both software heavy.

  1. Stop using CDC and write your own custom protocol. You can then multiplex as many channels of data as you want over a single pipe. You'll need to write a driver for the QDX end and Linux/Windows/Mac that handles the comms and audio as a composite driver and on the host computer split the multiplexed data out and fake the COM ports so application software can see the COM ports and use them.
  1. Stay using CDC but again multiplex the data over the signal channel. At the host you'll need to write something that takes data from the CDC COM port and demultiplexes it and then fake the extra COM ports for applications to use.

Option 2 sounds easier to me but still quite some work.

Andy



From: [email protected] <[email protected]> on behalf of Hans Summers <hans.summers@...>
Sent: Tuesday, August 23, 2022 10:48 PM
To: [email protected] Notification <[email protected]>
Subject: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
?
Hi all

So there was some discussion here about implementing a second serial port on QDX. This would allow some configuration and monitoring activities to take place on one serial port connected to a terminal emulator, while another serial port is connected to WSJT-X for CAT control.?

Implementing a second serial port using microcontroller UARTs is a relatively straightforward proposition however, less useful than it would be to be able to have TWO serial ports across the USB cable. However, resource constraints mean that it appears difficult, perhaps impossible, to support TWO serial ports on USB - that's why I am asking if there are any USB experts on here.?

Details - the serial port is the Communications Device Class Abstract Control Model (CDC ACM). The STM32F401 used has a USB peripheral supporting 4 pairs of endpoints. For non-USB experts... endpoints are like a USB communication channel between the PC and the device. In QDX these are used as follows:

0: USB control endpoint - this is always endpoint zero in any USB system
1: CDC Data in/out endpoint pair
2: CDC Command endpoint
3: Audio in/out endpoint pair

The Composite device (thought of like a USB Hub) layer sits above that but does not use up any endpoints itself, it's just a wrapping.

Since the STM32F401 has 4 pairs of endpoints and these are all used, it appears that implementation of a second serial port is impossible. But the world is full of tricks. There could be ways. Does anybody know? It is nice to dream that there might be some way to hack around in the code in the lowest layers of USB code and somehow fake something to look like there are more endpoints than there really are??

73 Hans G0UPL


 

You probably know this already but I am learning¡­.
A single USB host controller can allow?
up to 127 connected devices. A connected USB hub counts as a USB device address, and every device connected to it goes towards the maximum allowed addresses for that one host controller. A single USB device can allocate up to 32 endpoints.

So there must be a way of doing it.
73 Ken g4apb?


 

¿ªÔÆÌåÓý


can allocate up to 32 endpoints

The key words are "up to". The STM32F401 in the QDX has many fewer endpoints.
Andy


From: [email protected] <[email protected]> on behalf of KEN G4APB <lfoofui.nbz42@...>
Sent: Wednesday, August 24, 2022 1:58 AM
To: [email protected] <[email protected]>
Subject: Re: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
?
You probably know this already but I am learning¡­.
A single USB host controller can allow?
up to 127 connected devices. A connected USB hub counts as a USB device address, and every device connected to it goes towards the maximum allowed addresses for that one host controller. A single USB device can allocate up to 32 endpoints.

So there must be a way of doing it.
73 Ken g4apb?


 

¿ªÔÆÌåÓý

What's the purpose of:

2: CDC Command endpoint

in this scenario? ?If it's just setting parameters of the data channel, can you set those to some reasonable defaults and use that channel for something else?

Just brainstorming!

73, Willie N1JBJ

On Aug 24, 2022, at 1:48 AM, Hans Summers <hans.summers@...> wrote:

0: USB control endpoint - this is always endpoint zero in any USB system
1: CDC Data in/out endpoint pair
2: CDC Command endpoint
3: Audio in/out endpoint pair


 

I am definitely no USB expert, nor am I an STM32 expert.
This article doesn't say anything about the "endpoints", but does discuss multiple serial interfaces:
might be worth a look.

--
Rob KB8RCO


 

I saw an idea on Google. Have the QDX report as a hub with two devices on it?

Colin - K6JTH

On Wed, Aug 24, 2022 at 6:37 AM Rob Giuliano via <kb8rco=[email protected]> wrote:
I am definitely no USB expert, nor am I an STM32 expert.
This article doesn't say anything about the "endpoints", but does discuss multiple serial interfaces:
might be worth a look.

--
Rob KB8RCO


--
Colin Kaminski - K6JTH
https://www.qsl.net/k6jth/


 


Colin, QDX reporting as a "hub" with two USB devices on it is exactly what it does already. The two devices are Audio and Serial. There just isn't, at first sight, space for any more, as far as the hardware resources go.

Rob, I've seen the triple Serial to USB thing before. The "Blue pill" uses the STM32F103. For whatever reason, although a considerably less well endowed device than the F401, in almost every way, in the particular area of its USB peripheral endpoint count it is superior, the F103 having 8 endpoints compared to 4 on the F401.?

73 Hans G0UPL
http://qrp-labs.com
https://www.buymeacoffee.com/g0upl


-------- Original message --------
From: Colin Kaminski <colinskaminski@...>
Date: Wed, Aug 24, 2022, 5:03 PM
To: [email protected]
Subject: Re: [QRPLabs] USB experts? Question about serial devices, implementing multiple ports on QDX
I saw an idea on Google. Have the QDX report as a hub with two devices on it?

Colin - K6JTH

On Wed, Aug 24, 2022 at 6:37 AM Rob Giuliano via <kb8rco=[email protected]> wrote:
I am definitely no USB expert, nor am I an STM32 expert.
This article doesn't say anything about the "endpoints", but does discuss multiple serial interfaces:
might be worth a look.

--
Rob KB8RCO


--
Colin Kaminski - K6JTH
https://www.qsl.net/k6jth/