Pages

07/09/2017

Flashing the DVMega UHF with the latest firmware using an Arduino Uno and a Raspberry Pi

In case you've missed it, there's a new firmware release out (3.17) for the DVMega - a small transceiver that can operate as a Digital Mode Hotspot that supports DMR, D-Star and Fusion.

Unless your DVMega is brand new (purchased after 2017-09-07) it's safe to assume you're on an older version. You can always check your current version in the MMDVMHost logs or your preferred MMDVMHost dashboard.

Unfortunately there's no built in way to upgrade the firmware, which leaves you with a couple of choices depending on your board-

  1. Remove the large chip and flash it with an Arduino Uno, a microcontroller that uses the same chip as the DVMega (UHF Version Only!)
  2. Solder a wire between two points on the board and program it direct from the host computer or Raspberry Pi. (Both Versions)


If you'd prefer to solder the wire to avoid having to purchase an Arduino Uno, or in the case of the dual band version you have no choice, I thoroughly recommend G0WFV's blog post, which inspired me to write this one for flashing with an Uno.

If you'd prefer to use an Uno because you're either not confident with the soldering or in my case you'd rather not have an unsightly wire flapping around on your DVMega so you can flash it twice a year, then read on.
DVMega on a custom Orange Pi Zero 'Hat' with the chip circled


Disclaimer

This is a hands on process. Whilst its unlikely that you will make the chip completely unusable (unless your short it or insert it the wrong way around) its plausible that the flashing may fail part way through rendering your DVMega temporarily out of action. You should just be able to flash it again to fix the issue, but I can't accept responsibility if it goes wrong.

Preliminaries

To use the Arduino Uno method you will first need an Arduino Uno and the appropriate cable (Usually USB 2.0 B type). Make sure you get an Uno with the full sized chip and not one of the SMD models. A 'clone' or 'compatible' version should work fine. The cheapest I could find was £5.49 on Ebay but double check with the seller that they're shipping the full sized DIP version first.

In theory you should wear an anti-static wrist strap whilst working with semiconductors, but I've not had any issues going without.

Don't plug in or power up the Arduino Uno until instructed to do so!

Swapping the chips

In order to program the DVMega chip you will need to remove the large black chip from both boards, place the DVMega chip in the Uno, flash it, and then swap them back. It might be sensible to mark the DVMega chip with some paint, tipex, nail varnish, whatever you have handy.

If you have one handy you can use a fancy IC extractor, however my cheapo one usually causes more harm than good. Instead I use a thin flat blade screw driver and insert it into each end and twist it slightly to loosen the chip. Once loosened you can usually just pull it out with your fingers. 

Be careful not to bend the pins! 

Whilst you're at it, make a visual note of the 'notch' and the 'dot' in the corner of the chip. For the UNO these should be furthest away from the USB connector, and on the DVMega they should be furthest away from the GPIO header socket.


The chip that needs removing from the UNO is circled.

Once removed, you can carefully push the DVMega into the socket of the UNO. You don't need to ram it all the way home, just enough to make electrical contact but ensure its still easy to remove.

Discovering the Arduino 'port'

Now the DVMega chip is in the Arduino, we can flash it. Connect to a terminal session running on the Raspberry Pi via SSH or a local screen and run-
sudo su

If you're running pi-star, make the file system read/write-
rpi-rw

Run dmesg to find out which 'port' the Arduino is connected to-
dmesg

You should see something like the following-
[    2.269154] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    2.414242] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043
[    2.416199] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
[    2.419794] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
[    6.899923] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device

Which tells you that the Arduino is connected to /dev/ttyACM0.

Installing the software

Before you can flash the chip its best to ensure you have the correct software packages installed-
apt-get update
apt-get install avrdude zip wget

Downloading the new DVMega binary

Go to the DVMega software page and double check the latest version for your board. For the DVMega Single Band board you're looking for this section-

BlueDV-MMDVMhost

Raspberry PI based Support for D-Star, Fusion and DMR auto mode

Singleband and Dualband Radio

The current firmware is 3.17

Change into your home directory, just in case-
cd ~/

Download the firmware-
wget http://www.dvmega.auria.nl/images/DVMEGA_RH_V317_UNO.zip

Unzip it-
unzip DVMEGA_RH_V317_UNO.zip -d DVMEGA_RH_V317_UNO

Flashing the binary to the Arduino UNO

Change into the unzipped directory-
cd ~/DVMEGA_RH_V317_UNO

And run avrdude to flash the binary, remembering to change your serial port if necessary-
avrdude -p m328p -c arduino -P /dev/ttyACM0 -b 115200 -F -U flash:w:DVMEGA_HB_V317_UNO.cpp.hex

You should then see something like the following, indicating flashing was successful-
avrdude-original: Using autoreset DTR on GPIO Pin 7

avrdude-original: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude-original: Device signature = 0x1e950f
avrdude-original: NOTE: "flash" memory has been specified, an erase cycle will be performed
                  To disable this feature, specify the -D option.
avrdude-original: erasing chip
avrdude-original: reading input file "DVMEGA_HB_V317_UNO.cpp.hex"
avrdude-original: input file DVMEGA_HB_V317_UNO.cpp.hex auto detected as Intel Hex
avrdude-original: writing flash (31172 bytes):

Writing | ################################################## | 100% 6.09s

avrdude-original: 31172 bytes of flash written
avrdude-original: verifying flash memory against DVMEGA_HB_V317_UNO.cpp.hex:
avrdude-original: load data flash data from input file DVMEGA_HB_V317_UNO.cpp.hex:
avrdude-original: input file DVMEGA_HB_V317_UNO.cpp.hex auto detected as Intel Hex
avrdude-original: input file DVMEGA_HB_V317_UNO.cpp.hex contains 31172 bytes
avrdude-original: reading on-chip flash data:

Reading | ################################################## | 100% 5.06s

avrdude-original: verifying ...
avrdude-original: 31172 bytes of flash verified

avrdude-original: safemode: Fuses OK (E:00, H:00, L:00)
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe
strace: |autoreset: Broken pipe

avrdude-original done.  Thank you.

strace: |autoreset: Broken pipe


If not, try hitting the reset button on the Arduino UNO a few times or removing the USB cable completely and reinserting it before running avrdude again.

Returning the chips to their relevant device

You should now be able to unplug the UNO, remove the chip and place it back into the DVMega using the same process as above.

Remember the orientation,  the 'notch' and the 'dot' on the UNO should be furthest away from the USB connector, and on the DVMega they should be furthest away from the GPIO header socket.

Now the chip is flashed and back where they should be, you should be able to stick the DVMega back on your Raspberry Pi or BlueStack and use it as you were before.

Acknowledgments


  • G0WFV - Wrote a blog post that inspired this one 
  • PE1PLM - DVMega Creator



73!

No comments:

Post a Comment