Flash your DV-Mega from Pi-Star

From PiStar Wiki
Jump to: navigation, search

1. Login to your Pi-Star over SSH (either on your PC using an SSH client or using the built-in client available at http://pi-star.local/admin/expert/ssh_access.php

2. Change to the /tmp folder

 [email protected](rw):~$ cd /tmp

3. Download the flashing tool(s)

 [email protected](rw):tmp$ wget http://www.pistar.uk/downloads/dvmega-flash-tools.zip
 --2017-11-22 21:36:38--  http://www.pistar.uk/downloads/dvmega-flash-tools.zip
 Resolving www.pistar.uk (www.pistar.uk)... 104.27.185.136, 104.27.184.136, 2400:cb00:2048:1::681b:b888, ...
 Connecting to www.pistar.uk (www.pistar.uk)|104.27.185.136|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 851 [application/zip]
 Saving to: ‘dvmega-flash-tools.zip’
 
 dvmega-flash-tools.zip           100%[=========================================================>]     851  --.-KB/s   in 0s     
 
 2017-11-22 21:36:38 (22.1 MB/s) - ‘dvmega-flash-tools.zip’ saved [851/851]

4. Download the DVMega firmware from the download site: http://www.dvmega.auria.nl/Downloads.html

 [email protected](rw):tmp$ wget http://www.dvmega.auria.nl/images/DVMEGA_RH_V319_UNO.zip
 --2017-11-22 21:38:06--  http://www.dvmega.auria.nl/images/DVMEGA_RH_V319_UNO.zip
 Resolving www.dvmega.auria.nl (www.dvmega.auria.nl)... 89.18.176.53
 Connecting to www.dvmega.auria.nl (www.dvmega.auria.nl)|89.18.176.53|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 26419 (26K) [application/zip]
 Saving to: ‘DVMEGA_RH_V319_UNO.zip’
 
 DVMEGA_RH_V319_UNO.zip           100%[=========================================================>]  25.80K  --.-KB/s   in 0.03s  
 
 2017-11-22 21:38:06 (774 KB/s) - ‘DVMEGA_RH_V319_UNO.zip’ saved [26419/26419]

5. Unzip the firmware and the tools

 [email protected](rw):tmp$ unzip -d dvmega dvmega-flash-tools.zip
 Archive:  dvmega-flash-tools.zip
   inflating: dvmega/flash_gpio.sh    
   inflating: dvmega/flash_usb.sh     
 [email protected](rw):tmp$ unzip -j -d dvmega DVMEGA_RH_V319_UNO.zip
 Archive:  DVMEGA_RH_V319_UNO.zip
   inflating: dvmega/Changelog.txt    
   inflating: dvmega/DVMEGA_RH_V319_UNO.hex

7. Change to the dvmega subfolder and run the script, for GPIO DV-Mega please use flash_gpio.sh - also note the use of sudo here.

 [email protected](rw):tmp$ cd dvmega/
 [email protected](rw):dvmega$ sudo ./flash_gpio.sh

8. You should get an output similar to:

 Warning: Stopping pistar-watchdog.service, but it can still be activated by:
 pistar-watchdog.timer
 Warning: Stopping dstarrepeater.service, but it can still be activated by:
 dstarrepeater.timer
 Found DVMEGA_RH_V319_UNO.hex firmware...
 
 avrdude-original: Version 6.1, compiled on Jul  7 2015 at 10:29:47
                 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
                 Copyright (c) 2007-2014 Joerg Wunsch
 
                 System wide configuration file is "/etc/avrdude.conf"
                 User configuration file is "/root/.avrduderc"
                 User configuration file does not exist or is not a regular file, skipping
 
                 Using Port                    : /dev/ttyAMA0
                 Using Programmer              : arduino
                 Overriding Baud Rate          : 115200
 avrdude-original: Using autoreset DTR on GPIO Pin 7
                 AVR Part                      : ATmega328P
                 Chip Erase delay              : 9000 us
                 PAGEL                         : PD7
                 BS2                           : PC2
                 RESET disposition             : dedicated
                 RETRY pulse                   : SCK
                 serial program mode           : yes
                 parallel program mode         : yes
                 Timeout                       : 200
                 StabDelay                     : 100
                 CmdexeDelay                   : 25
                 SyncLoops                     : 32
                 ByteDelay                     : 0
                 PollIndex                     : 3
                 PollValue                     : 0x53
                 Memory Detail                 :
 
                                          Block Poll               Page                       Polled
                   Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
                   ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
                   eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                   flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                   lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                   hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                   efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                   lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                   calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                   signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
 
                 Programmer Type : Arduino
                 Description     : Arduino
                 Hardware Version: 3
                 Firmware Version: 4.4
                 Vtarget         : 0.3 V
                 Varef           : 0.3 V
                 Oscillator      : 28.800 kHz
                 SCK period      : 3.3 us
 
 avrdude-original: AVR device initialized and ready to accept instructions
 
 Reading | ################################################## | 100% 0.00s
 
 avrdude-original: Device signature = 0x1e950f
 avrdude-original: safemode: lfuse reads as 0
 avrdude-original: safemode: hfuse reads as 0
 avrdude-original: safemode: efuse reads as 0
 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_RH_V319_UNO.hex"
 avrdude-original: input file DVMEGA_RH_V319_UNO.hex auto detected as Intel Hex
 avrdude-original: writing flash (32074 bytes):
 
 Writing | ################################################## | 100% 4.59s
 
 avrdude-original: 32074 bytes of flash written
 avrdude-original: verifying flash memory against DVMEGA_RH_V319_UNO.hex:
 avrdude-original: load data flash data from input file DVMEGA_RH_V319_UNO.hex:
 avrdude-original: input file DVMEGA_RH_V319_UNO.hex auto detected as Intel Hex
 avrdude-original: input file DVMEGA_RH_V319_UNO.hex contains 32074 bytes
 avrdude-original: reading on-chip flash data:
 
 Reading | ################################################## | 100% 3.39s
 
 avrdude-original: verifying ...
 avrdude-original: 32074 bytes of flash verified
 
 avrdude-original: safemode: lfuse reads as 0
 avrdude-original: safemode: hfuse reads as 0
 avrdude-original: safemode: efuse reads as 0
 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
 Once flashing has been completed, you should reboot your Pi-Star

Please note that the Broken Pipe(s) at the end are normal.