Seven CDC serial ports on a single USB MCU

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm thinking of using an ATxmega128A3U for a board that should have seven serial ports from a single usb cable.

The thing has 32 endpoints and in theory it should be capable of doing seven CDCs.

6 of them should be external, no problem, the xmegaA3 has seven UARTs. These six serials should behave like any standard usb-serial devices, independent of anything else on the board.

One of them is just internal for controlling other thing on the board (some relays, some inputs).

The problem is performance. I'm afraid of the 32Mhz cpu not capable of sustaining so many ports. Or about the performance of a single usb full speed port of sustaining 7 CDCs traffic.

Of course, there is a question: how much traffic there should be?

I'm thinking of just "limitting" the target traffic to 19200 continuous full-duplex on all seven ports in parallel - as a way of validating the design.

Anyone having experience on this?

I'm in no way an USB expert of any kind, although I implemented some CDC on other MCU (a LPC one).

Oh, and a good question is about the PC drivers. It should be Windows. In the past I had some headaches about the windows drivers...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:
The problem is performance. I'm afraid of the 32Mhz cpu not capable of sustaining so many ports.
One of the four DMA channels can be allocated to USB.

Might consider XMEGA256A3U (doubles local SRAM)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

asdf

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Mon. Jun 24, 2019 - 08:18 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:
I've had 115k2 run reliably on a1.8MHz AVR, so if it's well programmed 32MHz should be doable with 7 serial ports.
Concur as XMEGA's DMAC has enough speed to meet rammon's requirements.

Paulvdh wrote:
How much would that doubled ram be?
16KB

Paulvdh wrote:
I think I would go searching for a chip with 7 integrated UsART's and USB.

These probably exist, ...

per MAPS, SAM D5x and E5x.

PIC32 may max at 6 UARTs.

 


Atmel AVR ATxmega64A3U, ATxmega128A3U, ATxmega192A3U, ATxmega256A3U Device Datasheet

ICC

DMA

615KBps between I/O registers and SRAM

115µA

via ATxmega256A3U - 8-bit AVR Microcontrollers

MAPS - MCUs & MPUs page

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

asdf

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Mon. Jun 24, 2019 - 08:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:

Because the only ARM uC I have any experience with is from ST, I had a short peek at the ST website.

In one of their uC families thay have at least 7 variants which have 8 built-in UsART's, but none of those also had USB.

A bit silly that you first have to choose a uC family before you can add stuff in the parametric table.

 

Also had a short peek at Digikey, they apparently have 80000 different uC's.

Their parametric search thing does not be detailed enough to search for things as number of UsART's.

Same with Mouser.

 

Same with Findchips.

https://www.findchips.com/parametric/Microcontrollers%20and%20Processors/Microcontrollers

 

Paul,

I also have used/using some ARMs, including some STM32.

I happen to use STM32F091 which has 8 USARTs, on one of my boards.

The problem is USB.

Tell me a STM32 part with 32 endpoints (16 bidirectional "adresses"), because I have to implement a composite CDC of seven !

The only other MCU that I find with 32 endpoints is PIC32, but I would prefer to use XMEGA.

I know quite well the xmega and AVR in general, using them for years in lots of projects.

The least that I need now is to start with an unknown architecture.

And about the host PC, this MUST BE a Windows PC. The company that makes the PC software for the thing is Windows centric, have lots of Windows developers, etc.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Based on my experience, 6x UARTS interrupting per-character bi-directional Serial ports would be pretty tough for a 32MHz CPU (depending on speed, of course.  And traffic patterns.)  Even without USB to contend with.    Probably doable, but probably significant effort to get good performance.

Don't forget that the AVRs (including Xmega) lack the "deep fifos" of most modern PC chipsets.  DMA for UART is problematic (on receive), and you don't have enough DMA channels to use two for each UART anyway.

(also, most USB CDC implementations are pretty awful when it comes to effective utilization. I think.)

 

I've seen some microcontrollers with FIFOs on their UARTs (they tend to look like someone plunked down some 16550 gate-array IP on the chip.)  TI's "Tiva" ARM chips are one: TM4C123GH6PM...  8 uarts with 16byte FIFOs...

 

(My experience is pretty old.  10MHz 68010-based terminal servers, with "many more" cycles per instruction than an AVR.  OTOH, slightly smarter async hardware.  A really depressingly low number of ports would work, if they were all full-duplex, full-speed.  Fortunately, the usual "use case" wasn't!  Still, we converted to smarter UARTs as fast as we could.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:

Paulvdh wrote:

Because the only ARM uC I have any experience with is from ST, I had a short peek at the ST website.

In one of their uC families thay have at least 7 variants which have 8 built-in UsART's, but none of those also had USB.

A bit silly that you first have to choose a uC family before you can add stuff in the parametric table.

 

Also had a short peek at Digikey, they apparently have 80000 different uC's.

Their parametric search thing does not be detailed enough to search for things as number of UsART's.

Same with Mouser.

 

Same with Findchips.

https://www.findchips.com/parametric/Microcontrollers%20and%20Processors/Microcontrollers

 

Paul,

I also have used/using some ARMs, including some STM32.

I happen to use STM32F091 which has 8 USARTs, on one of my boards.

The problem is USB.

Tell me a STM32 part with 32 endpoints (16 bidirectional "adresses"), because I have to implement a composite CDC of seven !

The only other MCU that I find with 32 endpoints is PIC32, but I would prefer to use XMEGA.

I know quite well the xmega and AVR in general, using them for years in lots of projects.

The least that I need now is to start with an unknown architecture.

And about the host PC, this MUST BE a Windows PC. The company that makes the PC software for the thing is Windows centric, have lots of Windows developers, etc.

 

And BTW, although it's important too, the chip may have "only" six uarts. The seventh CDC is "internal", it won't be made external on an uart. The seventh serial port is a PC software requirement. The PC software needs to control some things on the board and that's by using yet another COM port (the sofware will use the six ports provided by the board as six COMs controlling things outside the board, as thew were six independent USB-uart converters.) So, as the sofware already uses six COMs, it will use seven.

As I said, the software is on Windows. It is already developed on a prototype. The prototype has two FT4232 chips, providing eight serial ports on two USB ports, coming from an USB HUB chip. My board is connected now on one of these eight uarts. The idea is to simplify the whole thing.

Somehow good enough would be to keep the usb hub chip (the software company starts to like having some usb ports in reserve) and keep the two usb ports use, and replace the two FT4232 monsters with two XMEGA32A4U. This would become a three chip solution (HUB + 2X xMEGA) versus a brute force HUB + 2x FT4232 + some other MCU.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:

Based on my experience, 6x UARTS interrupting per-character bi-directional Serial ports would be pretty tough for a 32MHz CPU (depending on speed, of course.  And traffic patterns.)  Even without USB to contend with.    Probably doable, but probably significant effort to get good performance.

Don't forget that the AVRs (including Xmega) lack the "deep fifos" of most modern PC chipsets.  DMA for UART is problematic (on receive), and you don't have enough DMA channels to use two for each UART anyway.

(also, most USB CDC implementations are pretty awful when it comes to effective utilization. I think.)

 

I've seen some microcontrollers with FIFOs on their UARTs (they tend to look like someone plunked down some 16550 gate-array IP on the chip.)  TI's "Tiva" ARM chips are one: TM4C123GH6PM...  8 uarts with 16byte FIFOs...

 

(My experience is pretty old.  10MHz 68010-based terminal servers, with "many more" cycles per instruction than an AVR.  OTOH, slightly smarter async hardware.  A really depressingly low number of ports would work, if they were all full-duplex, full-speed.  Fortunately, the usual "use case" wasn't!  Still, we converted to smarter UARTs as fast as we could.)

 

I have the same worry.

I have a board that converts some ethernet custom protocol to eight uarts. The first board was using an xmega A3, seven uarts and one bit-banged. The SPI for the ethernet chip was bit-banged too, as the seven uarts ate all the spi ports too ... :-(

Never had complaints from the field, but I was curious about the real performance and done a stress test on it. The sustained rate on all eight ports full duplex was quite disapointing. 

So a new board revision was born with a STM32F091. 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rammon wrote:

Tell me a STM32 part with 32 endpoints (16 bidirectional "adresses"), because I have to implement a composite CDC of seven !

The only other MCU that I find with 32 endpoints is PIC32, but I would prefer to use XMEGA.

That sounds like a key determinant.

What baud rates do you need here and do they need to all be full duplex, & all at the same time ?

Do they need Hardware flow control ?

The next thing to check, would be the FIFO depth in the UARTs, especially on receive side ?

 

An alternative could be SPI-UART bridge devices, which tend to have reasonable FIFOs.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've done the UART->USB thing with 4 ports on an XMega256A3U. The device also has a Wiznet W5200 chip such that the UARTs are accessible over Ethernet in addition to USB.

 

The XMega chugs along quite happily servicing all 4 ports under light usage but does bog down significantly if all 4 are pushed hard at 38400 baud. Fortunately this is not the normal use case! I'd expect light usage with 7 UARTs to be fine.

 

I looked around for a suitable ARM part with a comparable number of USB endpoints but none appear to match the XMega in this department. Maybe things have changed in the last couple of years.

 

Steve

Maverick Embedded Technologies Ltd. Home of wAVR and Maven.

wAVR: WiFi AVR ISP/PDI/uPDI Programmer.

Maven: WiFi ARM Cortex-M Debugger/Programmer

https://www.maverick-embedded.co...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
(also, most USB CDC implementations are pretty awful when it comes to effective utilization. I think.)
Some better than others.

westfw wrote:
TI's "Tiva" ARM chips are one: TM4C123GH6PM...  8 uarts with 16byte FIFOs...
PIC32MZ DAK (plus 3 classes) is 6 UARTs with 8 deep FIFOs (transmit, receive)

fyi, PIC32MZ EF can run a BSD if one doesn't want a RTOS or roll-your-own scheduler.

Didn't look at PIC32MX.

westfw wrote:
10MHz 68010-based terminal servers, ...
Another take on a terminal server is to attach USB UARTs to a USB hub.

USB UARTs - MaxLinear

...

For applications where the USB interface may be disconnected and reconnected while a COM port is still open, MaxLinear provides the XRUSB1 Windows driver that eliminates the need to close the COM port in the host application. 

...

 


C code for Teensy: USB Serial

USB: Virtual Serial Port

(bottom)

Transmit Bandwidth Benchmark

...

PIC32MZ1025DAK176 - 32-bit Microcontrollers

Home · sergev/LiteBSD Wiki · GitHub (LiteBSD)

XR21x14x Universal Async Receiver Transmitters - MaxLinear | Mouser (USB UART)

 

"Dare to be naïve." - Buckminster Fuller