Homebrew, open source, repurposed, hacked, software defined, open hardware

Wednesday, 25 June 2014

A PCM290x based USB sound card for radio amateur and other uses

UPDATE:

design files are on github for the board, which will accommodate the PCM2902, PCM2904, PCM2906 versions (well, the PCM290x USB sound card IC family generally).

https://github.com/erichVK5/PCM290x-USB-audio-interface

I get the boards made by hackvana, who can be found on Freenode in #hackvana.

Open hardware for the win!

---------------------

The June 2014 edition of Amateur Radio magazine published a design for a USB sound card based on the PCM290x family of CODECs.

The depicted prototype used the PCM2904:


The board has optional connectors for the 3 switches supported by the CODEC, an SPDIF header for the codec models that support it, as well as space for 2 optional input and 2 optional output level adjustment potentiometers (Jumpered with 4 small wire links in the photo).

The board is 50mm x 50mm and has been designed for easy mounting in existing commercial rigs or homebrew rigs, or as a standalone unit. Input and output 3.5mm stereo sockets are supported to make connections simpler, as well as simple headers for those not using 3.5mm audio leads, and a Type B USB socket mounts directly to the board.

The option of an external regulated power supply for the ADC/DAC section of the CODEC is also supported.

Soldering was quick and easy, in fact three boards were done at once, using my hotplate liftoff jig technique.

A quick test after construction was successful with a G5RV equipped FT-817:

 

SDR homebrewers need to be aware of the one sample audio packet misalignment issue in some of the PCM290x revisions, and must either

1) choose unaffected revisions by studying the errata, or
2) empirically determine if the codec used does it, or
3) adjust their software to avoid phasing errors if using an affected codec

High quality hackvana made boards are now available at Aztronics

Here's the artwork, but homebrewers may struggle with the vias.


"Battery exhausted" on the Nikon Coolpix S3600 - a workaround - and Nikon firmware update hints for linux

The fairly new Nikon Coolpix S3600 had not been charged for a few weeks, and on trying to charge it with a USB cable, the charging light on the camera flashed rapidly  indicating an inability to charge, and then a "Battery exhausted" message appeared on the screen, and then the camera turned itself off completely.

This was a pretty revelatory disclosure from a device I was trying to charge.

It had a certain Rube Goldberg-esque-ness about it too.

The camera's manual told me it wouldn't charge below 5 degrees C. It was warmer than that, but I tried warming the battery in my hands and tried again - no luck.

I tried with the SD card in, out, back in again. No luck.

This seems to be a problem common to Li-ion batteries, namely, difficulty charging when a bit flat. The battery was an EN-EL19 3.7V 700mAh 2.6Wh battery.

I tried voltages ranging between 4.2V and 5.5V on the USB cable, but there was no change to the rapidly flashing light on the camera indicating inability to charge.

Some googling found the Nikon help page, which suggested a firmware upgrade to fix the charging problem that occurs with fairly flat batteries for multiple models, but the S3600 was not among the models with a firmware update available.

Furthermore, for the models listed, the instructions, for either OSX or Windows, both required me to turn on the camera and use the menu system to undertake the firmware upgrade... and also use the camera to format an SD card to deliver the new firmware.... Attentive readers will have noticed that the camera battery was flat.... or rather... "Battery exhausted"...

Further reading of the manual told me that the camera can charge slowly while attached to a computer. After plugging the camera into the linux netbook, however, it dutifully mounted, and the slow flash of the light on the camera told me it was now charging.

Well, this got around the unwillingness to charge problem.

I emailed Nikon about the problem. They got back to me within 24 hours and suggested I take it to an authorised repair centre.

"Kindly be advise that currently no known issue about the charging of the battery for the S3600. Kindly you may take the camera to the nearest Nikon service centre for further inspection. Details of the service centre are as per below:"
This seemed odd, because I found at least one reference to the same problem by another S3600 owner, a Mr S. McKay, on the web, and he'd been charged about the price of the camera in repairs not covered by warranty for what seemed like the same issue:

https://plus.google.com/110211862212172386392/posts/FYdHaGqjzAB

With a workaround now for the charging problem, I couldn't see the point of taking it anywhere. I will have to wait and see if they release a firmware update.

I was curious though about how I would be able to do an update using GNU/Linux. Having a look at some of the available firmware, I found it was available as either a self executing .exe archive, for example F-S6300-V11W.exe, or an OSX hfsplus compressed filesystem ".dmg" file, for example F-S6300-V11M.dmg, in the case of the S6300 model anyway.

... good to know that Nikon cater to both types of operating system...

So, for a worked exercise, and as a bit of a how to for others using GNU/Linux, I thought I'd extract firmware using ubuntu flavoured GNU/Linux for the S6300... that way, when an S3600 update is eventually released, I won't need to reinvent the wheel, and others might find it useful.

Nikon firmware update linux howto:

This guide uses the Nikon S6300 as an example.

Other Nikon camera firmware files may differ.

Firmware upgrade instructions for other cameras may also differ.

Be warned, using this guide with the wrong firmware could brick your camera, so use at your own risk.

Carefully compare these instructions with those provided by Nikon on their support website, to ensure you do not inadvertently brick your camera.

Repeat, use at your own risk!!!

First, download the OSX file F-S6300-V11M.dmg from the Nikon website into a local working directory, i.e.
~/Coolpix/
Then, you need to download the latest sourcecode for the dmg2img utility from
http://vu1tur.eu.org/tools/
which at the time of writing is dmg2img-1.6.5.tar.gz
gunzip dmg2img-1.6.5.tar.gz
tar xvf dmg2img-1.6.5.tar
cd  dmg2img-1.6.5
make

if you get "error: bzlib.h: No such file or directory"
sudo apt-get install libbz2-dev

if you get "error: openssl/sha.h: No such file or directory"
sudo apt-get install libssl-dev
then try to run make again

you can then run dmg2img from this directory to uncompress F-S6300-V11M.dmg

./dmg2img -i ../F-S6300-V11M.dmg -o ../F-S6300-V11M.img

You should see something like:
dmg2img v1.6.5 (c) vu1tur

../F-S6300-V11M.dmg --> ../F-S6300-V11M.img


decompressing:
opening partition 0 ...             100.00%  ok
opening partition 1 ...             100.00%  ok
opening partition 2 ...             100.00%  ok
opening partition 3 ...             100.00%  ok

Archive successfully decompressed as ../F-S6300-V11M.img

you now have an uncompressed hfsplus filsystem image called F-S6300-V11M.img in your  working directory. Go back to your working directory.
cd ..
I'll assume you don't have hfsplus filesystem support installed. You need to install ... you guessed it... hfsplus
sudo apt-get install hfsplus
sudo modprobe hfsplus
Now, you should be able to mount the image as a virtual device on a suitable mount point, in this case, I have chosen /mnt as a suiatble spot to mount it
sudo mount -o loop -t hfsplus ./F-S6300-V11M.img /mnt/
Then, if it has worked, you can
cd /mnt
ls -la
And you should be greeted with:
total 8204
drwxr-xr-x  1 root root       8 Apr  3  2013 .
drwxr-xr-x 23 root root    4096 May 31 00:26 ..
----------  1 root root 8388608 Apr  3  2013 .journal
----------  1 root root    4096 Apr  3  2013 .journal_info_block
drwxr-xr-x  1  501  501       3 Apr  3  2013 S6300Update
-rw-rw-rw-  1 root  501    3784 Apr  3  2013 .SymAVQSFile
d-wx-wx-wt  1  501  501       2 Apr  3  2013 .Trashes
You can then
cd S6300Update/
cd firmware
ls -la
and you will find
total 21636
drwxr-xr-x 1 501 501        3 Apr  3  2013 .
drwxr-xr-x 1 501 501        3 Apr  3  2013 ..
-rwxr--r-- 1 501 501 22151360 Mar 25  2013 firmware.bin
it is the "firmware" folder containing the "firmware.bin" file that needs to be copied onto the root directory of an SD card that has been freshly formatted in the camera.

I chose to copy the firmware folder to my working directory called "Coolpix" at this point
cd ..
cp -R firmware ~/Coolpix
cd ~/Coolpix
I then unmounted the virtual filesystem
sudo umount /mnt
So, you now have a local copy of the firmware.

your Camera should be charged by now. Press the menu button, go into the tools "Wrench/spanner" icon, and scroll down to Firmware. It should say "Version 1.0" if you have the battery charging issue.

Now, insert a spare SD card and format it in the camera. Having done this, turn the camera off.

Insert the SD card in the linux machine which should automount it
df
should show something like (for my spare 512MB SD card it shows this):
/dev/sdb1         495232        64    495168   1% /media/NO_NAME
now, copy the firmware file over to the card
cp -R firmware/ /media/NO_NAME/
Then check if it is there
ls /media/NO_NAME/
which should show:
DCIM  firmware  MISC  NIKON001.DSC
then look in the firmware folder:
ls /media/NO_NAME/firmware/
which should show something like:
-rw-r--r-- 22151360 Jun 25 00:09 firmware.bin
then unmount the card:
sudo umount /media/NO_NAME/
then put the card into the camera. Turn the camera on, press the menu button, go into the tools "Wrench/spanner" icon, and scroll down to Firmware. It should allow you to upgrade if you have the right firmware.