5354
XL2; USB Hub support
XL200

USB Hub Support for the XL200 ARM (lets several USB devices share the controller's single USB port)

The XL200's USB port could previously work with only one device at a time. It can now work through a standard USB hub, so several devices can be used at once. This was confirmed on the bench with a network adapter and a flash drive plugged into a hub at the same time - both fully working, while the machine's normal EtherCAT motion communication continued without any disturbance.

Reaching that point required fixing four long-standing defects in the USB software supplied by the chip vendor. None had ever caused trouble before, because no hub had ever been connected to this product, so these code paths had never actually run. The most significant of them quietly consumed an internal resource every time a hub was unplugged; left alone it would eventually have stopped USB working until the controller was power cycled. That path has now been unplugged and reconnected ten times in a row with no sign of degradation.

A separate and more serious problem was found and fixed along the way. The coprocessor sets aside a small workspace for handling hardware interrupts, and the extra activity a hub creates overflowed it - which then corrupted the operating system's own internal data. When that happened the coprocessor detected the fault, logged a task error with its diagnostic details, and restarted itself, which is the designed behavior. What made it hard to trace was that the corruption struck whatever the coprocessor happened to be doing next, so the details recorded pointed at an unrelated part of the system rather than at the real cause. That workspace is now four times larger, in all five controller programs.

One follow-up item came out of this: the way these faults are recorded can be improved so that the logged details identify the true source when the fault happens inside interrupt handling, which would have saved considerable time here.

Groundwork for USB keyboard and mouse support is included but is not yet active. Those devices will be recognized when plugged in, but they do not yet send keystrokes or pointer movement to the display. That work is fully specified and is the next step.

Current limitation: testing used a hub without its own power supply and two devices. How many devices the port can support on its own power has not yet been measured, so a hub with its own power supply is the safer recommendation until that is characterized.