Brace yourself for the USB-C fireworks

Tonight I read an article on whether bad USB to USB-C cables can damage laptops given some recent experiences.

It occured to me to look into the USB-C spec. A USB-C device can negotiate up to 20V @ 5A which is 100 watts of power. Compare this to USB 2’s 5V @ 500mA = 2.5W and even USB 3’s paltry 5V @ 900mA = 4.5W.

This means USB-C can potentially output 4 times the voltage at 5 times the current = 20 times the power of USB 3. Has anyone stopped to think of the failure modes here? It didn’t take me long.

Failure 1 – Intermittent Cable
What’s going to happen when you plug in your USB-C power guzzler which negotiates the port to 20V/5A. Then the 3 year old cable that’s become mangled, pinched and chewed partially shorts out? 100W will generate a lot of heat real quick (try holding a 100W incandescent light bulb).

Failure 2 – Loss of Voltage Regulation
USB 1 and 2 are a fixed 5 volts. This is most likely derived from a power rail supplying many other components, a fixed 5 volts carefully regulated by the system power supply.

USB-C offers negotiated variable voltage which will be generated by a  local power converter (each port would need its own). The negotiation occurs when a device is connected to set the voltage/current limit. I sure hope they put a good checksum on that negotiation.

So, what is your USB drive or battery charger (which happily negotiated 5V upon connection)  going to do when the inevitable g-g-glitch, power spike, electrostatic discharge or silicon failure ramps the port to its potential 20V limit (which is still ‘valid’ for the port)? What about unplugging a 20V device and the port not realising it (or latching up) before you plug in a 5V device?

With all those available amperes of current, the result will be spectacular. Voltage-overloaded devices love more amperes.

Maybe the “Safely Remove Hardware” option will take on a new importance.

Well publicised recalls of dodgy USB-C cables have already occured, and these are problems out-of-the-box. As hardware ages in the real world, I predict stories of fireworks and a market for bogus USB-C circuit breaker dongles.

Busted A Cap

The other evening I cranked my somewhat old HT system to test out a new USB optical audio interface. Next day I noticed a lack of treble in the left speaker. Hmmmm.

The main speakers are Yamaha NS200s, over 15 years old. At first I thought I’d blown the tweeter but continuity was OK and swapping with the right speaker’s was conclusive. Pulling the woofer from the bad speaker, I discovered a capacitor in the crossover had blown its end off. I cut it free.

bursted cap
Its a 160VAC 2.7uF paper capacitor. Without getting all fancy, I figured a 250V 2.7uF metal film polypropolene should be a suitable replacement. At my age I’m hardly a golden ear and modern polys seem to have a good reputation in crossovers.

I didn’t want to take the crossover out, its glued and stapled in place and mechanical things give me the shits. So I left a lot of the original leads in place and used barrier screw terminal blocks to attach the replacement cap, which is smaller and has radial instead of axial leads. Glued everything down (including the terminal block screws), with two screws per connection I figure it will be adequate given the speaker isn’t doing the deep bass anyway.

This shows the front of the HT setup, the room is huge so the 40″ TV (6 year old LA40B650) looks comically small but we usually watch TV from beanbags so its adequate.

speakers

The TOSLink SPDIF interface is a Turtle Beach Audio Advantage Micro II.

Audio Advantage

Its working extremely well feeding 5.1 audio to my Yamaha RX-V595 amplifier. The amp only supports standard AC3 and DTS, none of this modern 24bit 96kHz stuff. When that becomes a problem I’ll set up an external decoder or get a new amp, instead of downconverting it in the HTPC.

One note with the Audio Advantage – you need to install the driver from Turtle Beach’s website as the default that Windows 10 installs doesn’t offer the digital out. You can force Win10 to use the TB driver and that creates a separate digital out sound device. With that selected for my media player, all I had to do was enable SPDIF passthrough in my audio decoder (LAV Audio Decoder) and my amplifier’s display and AC3/DTS test files absolutely confirm that each speaker is being individually driven.

Fast RGB Matrix Graphics on Arduino

My first Arduino project was this Rainbow Block Kit from Maker Studio,
It came with a good Uno compatible board and an 8×8 RGB LED
matrix and driver board (I’ve since bought more).

I got it working with the RainbowDuino software after some changes but
found it a bit slow, so I wrote my own library/driver for it which I’ve called “ARGB” as it does alpha blended graphics at good frame rates with up to 3 chained panels (though with 3 memory is pretty short given there is only 2K of RAM and my library works best with double buffering).

Here is my library in action, including the “disco clock” I’ve built for myself.

As the video was taken at 25Hz, it doesn’t do some of the effects justice as the panel refreshes far faster.

The ARGB library features fast line/box/circle/text drawing with RGB colour plus transparency, flicker free double buffering, fast data transfer to the panel (so more time for animation, text overlays) and real time clock timekeeping (useful so long as your Arduino has a crystal).

I’ve put the library (includes a simple demo) on github:

https://github.com/rmacri/ARGB

The display is refreshed at 125Hz with a line refresh rate of 800Hz. I’ve made my effects update at half the panel refresh rate, 62.5 Hz is fast enough for smooth colourful animations.

Apple II 8 Bit Sound Card

When I bought an Apple //e in the mid 80s (replacing a very hacked Apple ][+) it came with a small card with a speaker on it called “SAM – Software Automatic Mouth” which allowed the Apple to talk.

SAM

The SAM card was an 8 bit DAC, implemented with a latch, DAC chip and amplifier for the speaker. I’d connected it to my sound system and discovered I could get pretty good crunchy 8 bit sound playback (less noisy than the Mac+ I also had at the time, no dither noise).

Around the time I’d written a drum sequencer that triggered a real 70’s era analogue drum box through the 4 game port annunciator outputs. One of the Mac music programs had some drum samples and I tried playing them using the SAM card. It worked great and in 1987/88 I ended up writing a 16 channel / 4 simultaneous voice mouse driven drum machine for the Apple II+ and //e.

Unfortunately the SAM card got left behind in a move and its a rarity on eBay. Recently after researching a few DACs and even an R-2R ladder option, I found an interesting chip that had promise, the AD558. This is pretty much a one chip solution. Internally calibrated, running on a single 5V supply, direct CPU bus compatibility and with a buffered output, it can be configured for a 0 to 2.8V output, perfect for a line level audio out.

From the AD558 datasheet and Apple II reference manual, I came up with this circuit:

Apple II 8 Bit Sound Card

The only additional passive components are:

  •  0.1uF power decoupling capacitor – unpolarised greencap, 25V rating would have been enough, the one I had was double that.
  • 6.8uF electrolytic capacitor. This blocks the DC offset in the 0-2.8V output, giving a ±1.4V output, which should be plenty as its going into my mixer.
  • 20kΩ  resistor, this is there to let current charge the blocking capacitor if the output isn’t connected (avoiding a transient on connection), I’d originally thought 10kΩ but settled on it after finding it first, its value is not critical.

I used an Apple II prototyping board which are still available here,  an Apple II slot card which includes solder pads yet breaks out all the port pins to a wire wrap header. I initially planned to wire wrap it all, but I hadn’t ordered a wire wrap socket (and the pins might not have easily fit through the plated-through holes anyway), so I used one of the spare 20 pin sockets I’d recently bought to fix my mouse card, carefully ignoring the extra holes as the AD558 has 16 pins!

With the 8 data inputs on the AD558 arranged neatly in a sequence that corresponds to the data bus on the Apple slot connector, I directly soldered them to the connector using stripped wirewrap wire which, being silver plated, is a breeze to solder. For me it involved a lot of bright lights, looking through  a number of magnifying glasses and some patient assistance from my wife, Oak.

soldering

Keeping the solder from running up the length of the slot connector was not easy, I eventually discovered that gravity can be your friend. For each of the 8 data bus wires I attached the slot end first then stretched the fine wire to its pin on the socket, (which I’d soldered in first) so it was just a case of heating a pin up so its corresponding wire could be slipped next to it, then the remaining wire cut off.

I took these photos as part of inspection, you can see the 8 fiddly data wires at the bottom right. Ignore the solder along the top edge of the board, its just strain reliefs for the line out cable.

apple II 8 bit dac 2

On the row opposite the data pins on the AD558 (pins 9-16),  a few adjacent pins need to be bridged. I ran a wire across them, trying to avoid touching the board itself as all the slot pin have traces criss-crossing to the wire wrap header (on the right on the photo below). If the thin insulation on the board was breached by solder, things would get unpleasant. I took particular care to keep away from the 12V line (pin 50 on the slot connector) as really bad things happen if that gets into TTL chips. I know from childhood experience.

apple II 8 bit dac 1

Looks real classy doesn’t it.

The proto board’s half solder/half wire wrap design is really not ideal for building much on the board itself. I think it was intended to have a daughter board (eg: Arduino) hang off it. I would have preferred either bigger holes just for wirewrapping or a board without the wirewrap header and associated traces across most of its area, other proto boards have little pads for soldering to at the slot connector.

I did use wire wrap and the wire wrap header to connect to the device select, read/write and power lines. I’d bought the tool and wire after all, and wanted to stay away from the slot connector after my experience with the data lines.

Mounting the capacitors and resistor was uneventful and I ran the audio to the shielded audio cable at the top of the board with little consideration for what its crossing along the way, fully expecting I’d deal with noise later, once I’d tested the board.

With the card in slot 5, writing alternating 1, 0, 2, 0, 4, 0, etc to $C0D0 generated progressively louder clicks. Both the SAM software and my drum machine worked perfectly first time.

The audio output is surprisingly quiet given the unshielded wires and cross-crossing bus on the board. Plus I’m running without any special power supply regulation for the DAC, the AD558 has its own internal reference. What a great chip, glad I bought a few as I’ll have to do something for the Arduino with one or two.

 

Apple //e Mouse Card Fix

My Apple //e mouse card was not being detected, and looking at its ROM (at $C400 when in slot 4), there was clearly a problem, the top 2 bits were random whereas the bottom 6 matched a ROM dump (apple2.org.za is a great resource).

I suspected a bad PROM, a common problem in equipment of this era. I arranged a replacement, a 2716 EPROM is compatible and Stephen from http://www.hobbyroms.com promptly burnt one and posted it to me.

Unfortunately it did not fix the card. Looking more closely at the hex dump, I realised the top 2 bits were being flipped to one OR zero, whereas bits in an aged PROM usually revert to 1 (confirmed by Stephen).

This didn’t leave much to fail, the card was being properly addressed for 6 of 8 bits to be working and continuity for all the data lines was good.

The one possible culprit was a 74LS245 bus transceiver, and of course it was the odd chip that wasn’t socketted.

Desoldering it from a double sided board with plated through holes was very tedious (big thanks to Oak given my vision). I took the approach of cutting the chip off first then working on each leg individually from both sides of the board. I cant say I recommend this, I was really worried given the through holes and fine tracks on the component side, but it measured intact after the holes were cleared.

The chip was replaced with a 20 pin socket and, thankfully, each pin had good continuity to its destination, no wirewrap wire hacks needed.

With a chip installed, the card has come good, I’ve left the new EPROM in there too.

Apple //e Video Tweak Avoids Color Killer Mod

During the break I spent some time playing with my Apple //e, recently set up after some 25+ years of neglect. Last year I replaced the PSU mains cap (common failure) and explored the excellent Apple ][ Disk Server and the Game Server – who could have imagined the cassette port transferring at 9600 bits per second! I didn’t have a joystick, which ebay has since solved, but given my vision I won’t be making any high score tables.

The //e is connected via composite video to my Samsung 27″ monitor/TV. I was very disappointed with the clarity of text, 80 column mode was unreadable even with the monitor on maximum sharpness. I remembered a far better display on the tube tele in the 80s.

The computer has a “text mode” switch on the motherboard. This cleared it up, but I don’t want a monochrome //e. I also noticed the monitor did give a clear picture for one second when I connected the video signal.

I figured I was suffering from chroma signal bleed through, forcing my monitor to interpret the signal as colour, and I’d need the color killer mod. This seemed confirmed by the picture clearing up if I snubbed out the PAL colour chroma oscillator with my finger.

My //e is a PAL version and I played with the 2 PAL chroma pots which adjust the background tint as a side effect of balancing the colour signal. I noticed they had no effect in text mode. Yet the text was equally blurry in text or mixed text/graphics mode.

Before the mod, I decided to at least set the chroma trimpots properly (for a black background in graphics mode) and I also tweaked the chroma frequency capacitor trimmer (this affected the moire patterns but not much else). I did this in mixed text/graphics mode with some text at the bottom.

To my surprise, as I approached the optimal position for the two chroma trimmers, the text sharpened up better than it had ever appeared on this monitor.

More importantly, in full text mode, it still looked great, as well as in 80 column mode and even 80 column + graphics. The chroma pots were still having an effect in text mode, even though the background colour didn’t reflect their setting.

I suspect that balancing the chroma signal properly prevents some noise reduction system in the monitor from kicking in, leaving a full bandwidth display in both text and graphics modes. In graphics mode the individual colour pixels are distinct, the best I’ve ever seen a PAL Apple ][ do (having never experienced a pure NTSC set up, let alone RGB).

So now no color killer mod needed.

New HTPC – Shuttle XS35GSV3

The ASRock ION 330 HTPC had been a faultless performer for nearly three years but in late December, the combination of a hot summer, a warm amplifier underneath it and a flaky case fan caused it to cook itself, leading to it becoming prone to lock up for periods of time. I changed the hard drive, reseated cables and replaced the fan. None of this helped (EDIT: Both 320GB WD drives were faulty), It seemed to have lost the ability to control the case fan properly unless I kept it on maximum fan speed, making it intolerably noisy.

After a few attempts at fixing it I decided to replace it and was pointed to the Shuttle series of totally silent fanless PCs by work colleagues. I bought the Shuttle XS35GS V3  which promised a totally silent home theatre PC experience.

I’ve not been disappointed.

I thought I’d be adventurous and gave OpenElec a try,. This is a very optimised XBMC Linux distribution. I found I had to use a more “generic” build as there wasn’t a build for the V3 hardware. After struggling with networking and messed up graphics for a day, I decided to go back to the flexibility of the software set I’d used previously, that being: TV Scheduler Pro for TV recording, Zoom Player for playback and EventGhost for IR remote control.

I started with XP and it was “ok”, but  Zoom Player (now at version 8.5 vs. version 6 on the ION) had moved on to using the excellent LAV Video Decoders that offered GPU accellerated playback of hi-def content, something I’d achieved using MPC Video Decoder.

I really liked the quality of the LAV Decoder (DScaler is now obsolete for me) but I couldn’t get it to work with acceleration. I discovered it needed the use of the EVR Video Renderer under Windows 7, at least.

I decided to skip Windows 7 and bought an upgrade to Windows 8. Installing it went pretty smoothly, I had to “forcibly” install the drivers for the KWorld Dual DTV USB Tuner and the LinkSys Dual Band USB WiFi (the onboard WiFi of the XS35GS is 2.4G only).

Application wise, everything ran well and the much maligned start screen was a non-issue, I’ve set up buttons on my harmony remote to take me straight to Zoom Player’s navigator for either TV Recordings or my media  library. Most importantly though, GPU accelerated playback using the LAV Video Decoders and DXVA2 seemed to work.

It wasn’t until more critical viewing that we realised that *every* video played had a tear in the centre when there was horizontal motion. It was as if it was switching frames at precisely the wrong time. This started a big investigation for the cause.

The problem occured when using the EVR Renderer with either LAV Video Decoder (DXVA2 or software decoder) or the FFDShow. decoder. With the Shuttle using a Radeon 7410M, there wasn’t much choice in drivers to try as its a custom mobile chipset. The video driver did not have the usual option for VSync and I tried both RGB and YCbCr pixel formats, and setting the display framerate to match the video (something which fixes typical tearing).

I tried what drivers I could get to load on it and was at my wits end as everything else was great including smooth low CPU DXVA2 playback of 50FPS 1080P.

Then I tried a slightly older Zoom Player EXE (8.50 instead of 8.51) and the problem went away! Yet when I renamed the older EXE to the regular ‘zplayer.exe’ name, the problem came back. What the…

Looking at the Explorer options on the EXE, the cause soon became clear.

Zoom Player had been installed with the Explorer compatibility option “Disable display scaling on high DPI settings” enabled. This option helps older apps run on the new very high resolution displays.

I’m not sure why, but switching this option off caused the tearing to completely disappear. Playback is now smooth and after some colour calibration, I am very satisifed with the results.

Here is the newly installed Shuttle sitting next to my amplifier.

 

Asus P5Q-E BIOS Lockout

Its the time of year I do maintenance and this includes backing up the operating system partition of my 4 year old quadcare VMWare host machine, with the idea of upgrading to VMWare 9. I do this by booting to a USB key full of utilities including Acronis TrueImage 2010 (the last version I bought and use now they added “activation” to it).

I was quite annoyed to discover that no matter what I typed, I could not access the usual boot device menu, not even get into the BIOS pressing the DEL key worked. This was alarming, what if I needed to enter the BIOS to fix something!

This started a process of testing various keyboards in the different USB ports as well as an old PS/2 keyboard – even that wasn’t recognised during boot. The USB keyboards worked OK in Windows but the PS/2 one didn’t, so it wasn’t clear if the port was functional.

I then noticed that pressing Caps Lock (a way for testing if keyboard interrupts are working) did toggle the Caps Lock LED, just upon power on but not once the BIOS logo screen came up. So I now knew both PS/2 and USB ports were working during the initial parts of P.O.S.T.

At this point, you probably would clear the CMOS RAM, but what if the firmware itself was corrupted? Then if the system didn’t let me reconfigure it, it would be toast.

I remembered I had the Windows based AsusUpdate. I installed it, re-flashed the same version of the firmware (P5Q-E-ASUS-1406) and got it to clear the CMOS RAM as well. That restored access to the BIOS.

So I am not exactly sure what had gone wrong. On the same day (December 24th 2012) I’d found my NAS’s BIOS forgot which drive to boot from, and my normally reliable security DVR spontaneously rebooted.

Gamma ray burst anyone 🙂

 

 

 

 

 

SPA3012 update

As a long overdue update to my last post here (a whole year ago), Linksys finally did release an update (spa3102_v5.2.13_FW) which I’ve been running since April 2012.

The ATA has been running flawlessly since then, with touchtone problems and dropped calls a thing of the past.

Linksys/Cisco SPA3102 broken promises

My Linksys VOIP ATA was acting up, refusing to call one of my SIP services even though it claimed it was registered. I was on firmware 5.1.10 which has been the latest for a few years. Searching the internets for news of any update, I stumbled on the unfortunate tales of promises unfulfilled, as expressed in these threads:

http://forums.whirlpool.net.au/forum-replies.cfm?t=1130617
right through to
http://forums.whirlpool.net.au/forum-replies.cfm?t=1544801

and then ending up here
https://supportforums.cisco.com/thread/2035426

Basically, I’m facing the same problem as many. The ATA works fine until you make a call through your PSTN connection. This switches the SIP codec to G711u and locks it there. If you have a SIP service that demands something different (G711a in my case), you’re out of luck and the only option is to reboot the ATA. Any options you set are disregarded after the PSTN call.

I learnt from the discussions linked above that for three years, a group of dedicated owners have been chasing Cisco for a firmware fix. Support promised that the fix was in testing for years, continually pushing forward the release deadline. The last promise was US Summer 2011, and thats long gone now.

As someone who has worked for the last 22 years on many projects (including commercial simulation, realtime systems and satellite modems) with a release cycle measured in days or weeks, all I can say is that it was good to be made aware of this sorry 3 year saga before I upgraded the ATA with something new.

For now I’ve downgraded it to an earlier firmware version (5.1.7) which doesn’t have the annoying and stupid bug.