Sending a Serial Break to a Cisco on Mac OSX

Ever need to reset the enable password of your Cisco router? One of the ways to do it involves sending a Break over the serial console line during boot. However! If you don’t have a good old-fashioned 100% genuine built-in serial port (and who the hell does these days!), but instead are using a USB to Serial adapter, this can sometimes be difficult. You youngins may not understand what a Break is on a serial port 😉 — but knowing what it is makes it a bit more clear why crappy $2 serial adapters suck at it. You know, these things:

Cheapie USB to Serial adapter

Cheapie USB to Serial adapter

In a serial port, you have a physical wire that transmits your data, called TXD. There are plenty of others, but that’s the one of concern. Normally while idle, the line is held at a logical 1 voltage level. (we say “logical” so you don’t make any assumptions about the voltage level, which may not intuitively map to the 1 or 0 value as you expect. In this case the actual voltage doesn’t matter, but RS232 typically swings between positive and negative 12-ish volts.) Data is sent by changing between logical 1 and logical 0 for each byte you send.

One RS-232 Data Frame

One RS-232 Data Frame

A Break is a kind of out-of-band signal – something you want to tell the receiving equipment that is NOT part of your data. Hence, it’s transmitted in a different way than your data bytes, so that the receiving equipment can know that it’s not data. For the Break, the TXD line is held at a logical 0 voltage for longer than one data frame. (There are short breaks and long breaks, also.)

As the Break is not just simple data being transmitted, you’ll find that some USB to Serial adapters and drivers don’t support sending Breaks properly. The Prolific pl2303 is one that I’ve had problems sending Break with on Mac OSX 10.9 Yosemite. (I haven’t tried one of the FTDI-based adapters that I have bumping around somewhere.) The manufacturer-supplied driver just doesn’t do it right, at least, the version that I downloaded and installed in late-2014. When I had to reset the password on a Cisco 1700 series router, using GNU Screen as the terminal app and typing C-a B or C-a C-b, it wouldn’t respond.

UPDATE 8/28: Please note! The open-source driver doesn’t work in Yosemite! There’s some stupid kext signing thing that kills it. You can uninstall it if you need by removing the osx-pl2303.kext directory from /System/Library/Extensions, and then reinstall the manufacturer’s driver. But you may lose the break! I haven’t tested. Bollox.

But there’s a workaround discussed by scottm32768 over here: http://www.mostlynetworks.com/2014/11/os-x-yosemite-prolific-usb-drivers/ Just be warned that enabling dev mode for kernel extensions opens a nice big security hole, letting Bad Guys run Bad Things if they get access to your machine. Practically speaking, it’s not a big deal. But still, be aware of your security exposure so you can act in proper context.

Luckily Martijn Pepping created an open-source pl2303 driver that supports sending Break, and changux has a GUI installer wrapper for it here. Thanks to both of them for helping us all out!

By the way, if you need to uninstall an existing Prolific driver before installing the open-source one, you can do it something like this:


# Delete the driver kernel extension...
sudo rm -rf /System/Library/Extensions/ProlificUsbSerial.kext
sudo kextcache -system-cache

# then verify that it's gone and the device doesn't show up,
# assuming you know what the device was before you deleted it!
ls /dev/tty*

Have fun sending Breaks!

 

GoPro HD Hero2 Won’t Turn On – Firmware Flash Fix

Update January 12, 2016: This seems to be very popular, and fixing a LOT of GoPro cameras! I’m going to re-visit this soon, and update it. I hope it can continue helping everyone save GoPros from the trash bin!

If you try this fix, remember to post a comment and let everyone know how it worked out!

Just recently, I had a problem where my GoPro HD Hero2 would not turn on, with battery or USB connection for power. Reading up on it a bit, I found that many others have had this issue, and aside from the few voodoo “fixes” which involved insert-remove-power-button-blah sequences, the only real fix was to re-flash the firmware. This seems to me to be a symptom of bit-rot in the firmware flash chip, with a weak cell or block, that would read out properly once in every 50 attempts to boot.

GoPro’s instructions for updating firmware involve downloading their CineForm software that has a magic flasher integrated somewhere. I don’t like big bloated software downloads to do little things, so I found a way to do it without it, on YouTube by user WellingtonBikeCam01. So, here is the fix, with much credit given to that video (which is marked CC-BY-NC, so here’s a modified version of the instructions with my own experience mixed in). Try this at your own risk. If your camera is under warranty, and you are not experienced with firmware flashing, just send it back to GoPro instead.

UPDATE: Check Dan’s comment below – and try putting the thing in the fridge for a few hours first! It’s worked for me on jinky hard drives, too.

For those who are curious about the fridge thing: Cold spray (in a can!) is commonly used as a diagnostic tool for electronics, because it does two things: first, it alters the physical dimensions of the device, which can cause micro-cracks to open or close or otherwise make themselves known; second, it alters the electrical characteristics of the device, possibly pushing it just into or just outside of a tolerance limit. This lets you identify broken parts, and (in our case) possibly coax something into working when it is otherwise not doing so. I suspect the flash memory chip, since they can fail by having their data fade away. Pushing the tolerance of “data won’t read” into “data just barely does read” by making it cold is possibly why this works for us here.

  1. Read all instructions and understand that if there’s a problem, it’s your problem, not mine. Make sure the camera battery is fully charged.
  2. Optional, for difficult cases: Put camera in fridge/freezer, inside a ziplock bag. See comments below for info.
  3. Download the latest firmware from GoPro here: http://software.gopro.com/Firmware/HD2/HD2-firmware.bin (“wget” and “fetch” also work, for those who prefer CLI)
  4. Copy the firmware file to an SD card.
  5. Optional: Remove camera from fridge/freezer.
  6. Insert the SD card into the camera.
  7. (Retry from here, see below) Remove and re-insert the battery.
  8. Place the camera on a solid table surface.
  9. Hold down the top “shutter” button while turning the camera on with the front “power” button.
  10. Release the shutter button only after the camera display appears.
  11. If the display doesn’t turn on within a few seconds, this boot attempt failed (yay bad flash chip). Go to the remove/insert battery step above where it says “Retry from here”, and do it over and over until it actually boots. It may take many tries!
  12. Press and release the power button, you need to do it quickly after the camera turns on and you release the shutter button (so I have read).
  13. A prompt will appear that says “press 1” – Press and release the power button. A prompt will appear that says “press 2” – Press and release the power button again.
  14. The camera will install the first update and turn itself off. The red light will blink, and it will show an updating icon on the screen. Don’t touch the camera at all! If the power is interrupted by a jinky battery connection during the flash, you may brick the camera! Don’t even wiggle the table. Just wait. My display said it was installing version 77 (bootloader maybe?).
  15. (v198 only, says the original YouTube instructions. Not sure if that’s the case?) Power the camera on, and the update will continue for about a minute, installing the next part of the firmware, and the camera will turn itself off. My display said it was installing version 222 (operating software maybe?).
  16. Delete the “HD2-firmware.bin” file from the SD card.
  17. After formatting the SD card in the camera, there will be a “version.txt” file in the “MISC” folder of the SD card. It will contain the long version of the firmware number, so instead of “v70” or whatever you had, you’ll see this: “firmware version”:”HD2.08.12.222.WIFI.R56.00″ (or whatever you put on)

Notes:

  • It’s recommended to delete all files from the SD card and format it freshly before doing a firmware upgrade.
  • All camera settings will revert to defaults after the upgrade. If you have any special settings, write them down first.
  • You may have to reformat your SD cards in the camera for them to be recognized. It’s always best to format cards using the device they are used in, instead of on a computer.
  • It’s a good idea to verify the hash of the new file before installing it.

SHA1 hashes:
v222 – 15a3858dec60467439fafd7804ea7d649b487634
v198 – 5031a90ce730591e207ddf3d6ae4546e22037eb8
v124 – a923d64ed486054244997863972c6aedd3ea197e
v70 – 47c8de1e88e6709f53de98462037e3dcb1e44758
v58 – 7468e67f62560eee40acbfa3f7cadd9e5ce0eb05
v50 – 328d97d4bde572fe83ccefb7a5f7f28fc209c539

I found in the process that there’s this thing called ProTune, which activates new framerates and resolutions that are useful for professional film shoots. It also applies a more neutral color curve to the recorded image, leaving greater latitude for color correction in post-production. Very handy!

I hope this helps someone else out there un-brick their GoPro. Great little cameras! And GoPro, use some better-spec flash chips, will ya? Thanks =)

And, finally, in the spirit of the YouTube author that made my day, this post is CC-BY-NC-SA.

UPDATE: After flashing, my camera was booting up just fine, but being jinky. It would stop recording after a few seconds, or randomly lock up, or otherwise behave badly. Did the usual routine of formatting the SD card in the device, etc. The first try of re-flashing died after a few seconds – I panicked, thinking I had bricked it. But, the bootloader/flasher was intact, and I was able to flash it again. It’s working better, but still locks up when flipping through menus, etc. Think I might be sending it back for replacement. Sigh!

UPDATE TO THE UPDATE: Two update? This is obviously too much of a hassle. During recording, it *appeared* to be locked for a few seconds, red lights stuck on, time counter at 00:08, nothing happening. Five seconds later, it counted up to 00:14 really fast, and kept going. I wonder if my SD card has bad blocks it’s controller is sparing out? Going to do a full zero-overwrite on it and see if it helps.

If you try this fix, remember to leave a comment and let everyone know how it went!

And if it doesn’t work, and your GoPro has finally given up the ghost, I can recommend the new GoPro Session cameras – they are a bit smaller, and less expensive than the full-size GoPro Hero 5 cams. I’ve gotta say, the Hero 5 looks pretty attractive for making pro-quality video in a tiny package…

 

Stratasys Dimension SST 768 DIY VGA Connector

So I’ve come across a new toy: a Dimension SST 768 3D printer! But, it was having some difficulty turning on and working. Tearing into the back of the system, I found three DC power supply boards (24V, 12V+5V, and 120V), a single-board computer, an overly-complex logic/controller board, and what’s labeled a “Power Distribution Board” which connects to all the steppers and other hardware.

First order of business was to check the power boards, which were all spot-on voltage output. Ruling that out, I needed to see what was going on during the boot process.

Thanks to another helpful blog post, I discovered that the SBC was an Ampro P5v – which was awesome, because the label for the board is buried under another one, and I couldn’t see it without tearing it all down. Didn’t feel like it that day.

From the manual for the SBC, we discover the pinouts for the video port, J5:

Pin Signal DB-15
1 Red 1
2 Ground 6
3 Green 2
4 Ground 7
5 Blue 3
6 Ground 8
7 Horizontal Sync. 13
8 Ground 10
9 Vertical Sync. 14
10 Fused +5V Power n/a

I dug out a ten-pin connector with ribbon cable attached, from an old 9-pin serial backplate. Snipped off the serial port, sacrificed an old VGA cable (since there were no DB15 jacks in my junk pile), and rigged up an adapter. It works perfectly! There are also keyboard and USB and all the other I/O you could want on that SBC, documented in the manual.

Now that we’re in, it’s time to root the beast, turn on SSH, bypass the cartridge EPROMs, and make some awesome. My beloved MakerBot, your big brother has arrived!