Powering USB Devices With A Bench Supply Adapter Board

Sometimes you wanna test a piece of USB hardware, but you don’t just want to plug it into a random old phone charger. [KS-Elektronikdesign] has whipped up a useful tool for just that case, allowing one to easily power USB hardware from a common bench supply.

It would have been simple enough to whip up an adapter board to connect banana jacks to the power pins of a regular USB port. Easing the hookup process was indeed a part of the motivation for this project, in making it easy to power hardware that hooks up via USB-A and USB-C. However, it also goes a little further. It includes TUSB319 chip to handle the all-important power negotiation, without which many USB devices will not feel confident drawing their required amount of current.

There is also polarity protection and over-voltage protection to stop you from blowing stuff up if you hook the board up wrong, which might save you a smartphone or three in the lab. The board will allow negotiated output power up to 10 W via USB-A and 15 W via USB-C, which isn’t heaps, but will be fine for lots of smaller devices. You can up that to 25 W and 35 W respectively if the board is switched to pass-through mode. We particularly like the physical design—the board will plug straight into the banana plugs on any supply with a jack spacing of 19 to 23 mm.

Overall, this is a useful tool to have in the lab if you want to run USB hardware with the flexibility of the voltage and current limits available on your bench supply. There are other ways to power modern USB devices, too, and you can do all kinds of wild stuff if you learn about USB PD and USB PPS. If you’re working up your own nifty lab tools for similar purposes, we’d love to know about it on the tipsline.

Linux Hotplug Events Explained

There was a time when Linux was much simpler. You’d load a driver, it would find your device at boot up, or it wouldn’t. That was it. Now, though, people plug and unplug USB devices all the time and expect the system to react appropriately. [Arcanenibble] explains all “the gory details” about what really happens when you plug or unplug a device.

You might think, “Oh, libusb handles that.” But, of course, it doesn’t do the actual work. In fact, there are two possible backends: netlink or udev. However, the libusb developers strongly recommend udev. Turns out, udev also depends on netlink underneath, so if you use udev, you are sort of using netlink anyway.

If netlink sounds familiar, it is a generic BSD-socket-like API the kernel can use to send notifications to userspace. The post shows example code for listening to kernel event messages via netlink, just like udev does.

When udev sees a device add message from netlink, it resends a related udev message using… netlink! Turns out, netlink can send messages between two userspace programs, not just between the kernel and userspace. That means that the code to read udev events isn’t much different from the netlink example.

The next hoop is the udev event format. It uses a version number, but it seems stable at version 0xfeedcafe. Part of the structure contains a hash code that allows a bloom filter to quickly weed out uninteresting events, at least most of the time.

The post documents much of the obscure inner workings of USB hotplug events. However, there are some security nuances that aren’t clear. If you can explain them, we bet [Arcanenibble] would like to hear from you.

If you like digging into the Linux kernel and its friends, you might want to try creating kernel modules. If you get overwhelmed trying to read the kernel source, maybe go back a few versions.

Easily Replaceable USB-C Port Spawned By EU Laws

The USB-C port has become a defacto connectivity standard for modern devices, largely supplanting the ugly mess of barrel jacks and micro USB connectors that once cursed us. While their reliability is good, they don’t last forever, and can be a pain to replace in most devices if they do fail. However, a new part from JAE Electronics could change that.

The problem with replacing USB connectors in most hardware is that they’re soldered in place. To swap them out, you have to master both desoldering and soldering leads of a rather fine pitch. It’s all rather messy. In the interest of satisfying the EU’s new Ecodesign for Sustainable Products Regulation (ESPR), JAE Electronics has developed a USB-C connector that’s easier to replace. Rather than being soldered in, the part is simply clamped down on to a printed circuit board with small screws. As the part is torqued down, small gold-plated contacts are compressed into pads on the PCB to make the necessary contact.

The connector is fully compatible with USB 4 version 2.0. (Don’t ask us how they number these things anymore.) It comes in single and dual connector versions, and is capable of USB PD EPR at up to 240 W (5A/48V). The part does have some drawbacks—namely, the footprint of the metal-shelled part is somewhat larger than most soldered USB C connectors. Whether this precludes its use is very much an application-specific matter for product engineers to decide.

In any case, if you find yourself designing hardware with heavily-used USB C ports, you might find this part useful. It’s not widely available yet, but some parts should be landing at Mouser in coming months. We’ve explored some of the ways USB-C connectors can be fouled and damaged before, too. Sound off with your opinions on this new part in the comments.

Continue reading “Easily Replaceable USB-C Port Spawned By EU Laws”

The Best USB To VGA Converter For The Job

There are many adapters, dongles, and cables designed for interfacing display standards, and no doubt some of you have them in the glue of your entertainment system or work space. They’re great for standards, but what about something that’s not quite standard? [Stephen] has an arcade cabinet with a CRT that runs at an unusual 336 by 262 pixel resolution. It can be driven as 320 by 240 but doesn’t look great, and even that “standard” resolution isn’t supported by many dongles. He’s shared the story of his path to a unique USB to VGA converter which may have application far beyond this arcade machine.

We follow him on a path of discovery, through RP2040 PIOs, simple resistor ladder DACs, and home-made kernel modules, before he arrives at GUD, a USB display protocol with its own upstreamed Linux kernel driver. It’s designed to be used with a Raspberry PI deriving an LCD or HDMI display, but for his task he implemented the protocol on one of the more expensive STM32 series microcontrollers. The result after several false starts and some fiendish PCB routing is a standalone GUD-based USB-to-VGA converter that delivers perfect 34-bit colour at this unusual resolution, and also presumably others if required. It’s a worthwhile read for the many hints it gives on the subject of driving displays, even if you’re not driving an odd cabinet monitor.

USB Video Capture Devices: Wow! They’re All Bad!!

[VWestlife] purchased all kinds of USB video capture devices — many of them from the early 2000s — and put them through their paces in trying to digitize VHS classics like Instant Fireplace and Buying an Auxiliary Sailboat. The results were actually quite varied, but almost universally bad. They all worked, but they also brought unpleasant artifacts and side effects when it came to the final results. Sure, the analog source isn’t always the highest quality, but could it really be this hard to digitize a VHS tape?

Continue reading “USB Video Capture Devices: Wow! They’re All Bad!!”

World’s Cheapest ARM Debugger Is Actually RISC-V

[bogdanthegeek] has a lot of experience with the ARM platform, and their latest escapade into working with cheap ARM chips recovered from disposable vapes involved a realization that it was just plain wrong to debug such recovered silicon with something as expensive as a Pi Pico. No, they needed to build a debugger using the super cheap CH32V003.

What follows is an interesting tour around ARM Debug Access Port (DAP) programmers and creating a practical USB-connected device that actually works with modern toolchains. The first problem to be solved was that of host connectivity. These days, it’s USB or go home, which immediately limits the microcontrollers you can choose. Luckily for [Bogdan], they were aware of the excellent work by [cnlohr] on wedging low-speed USB support onto the RISC-V CH32v003 with the software-only bit-banging rv003usb, which provided a starting point. The next issue was to check for interrupt-driven endpoint support (needed for low-speed USB) in the Mac OS X kernel, which they knew was being dropped at an alarming rate (well, at least for full-speed). Luckily, the CMSIS-DAP standard required support for interrupt-driven USB endpoints, so kernel support was likely intact.

Next, [Bogdan] noticed that the DAPLink project had been ported to the bigger, native-USB WCH chips like the CH32V203, so it was a matter of porting this code to the diminutive CH32V003 using the rv003usb stack for the USB support using [cnlohr]’s ch32fun toolchain. There were a few bumps along the way with a lack of clarity in the DAPLink code, and some inconsistencies (across platforms) with the USB library dependencies of the upstream tool pyOCD, but they did get some tools working on at least Mac OS and some others on Linux. Which was nice.

We’ve covered the CH32V003 a fair bit, with people trying to give it all kinds of big-CPU tricks, such as speech recognition (of sorts) or even building a supercluster.

Piers holding a USB One ROM.

One ROM Gets A USB Stack

Our hacker [Piers Finlayson] is at it again, and this time he has added USB support to One ROM.

With this new connectivity you can attach your One ROM to your computer with a USB cable and then in a matter of seconds upload new firmware from your Chrome (or Chromium) web browser. This new connectivity will supplement but not replace the existing serial wire connectivity because the serial wire connectivity enables certain advanced use cases not supported by the USB stack, such as reprogramming a ROM in-place as it’s being served. The new USB interface will probably suit most users who just want to use One ROM to manage the ROMs for their old kit and who don’t need the extra functionality.

Addressing the question as to why he didn’t have USB connectivity from the start [Piers] claimed it was because he didn’t like soldering the USB sockets! But given this is a service he can get from his board house that is no longer his problem! [Piers] said he picked Micro USB over USB-C because the former demands less circuit board real estate than the latter. Squeezing everything on to the board remains a challenge!

Continue reading “One ROM Gets A USB Stack”