Recently i run into an issue whilst trying to upgrade the mmdvm firmware on one of my raspberry Pistar gateways. I spent hours searching the internet for answers to find a fix, the error i was getting whilst issuing the upgrade command:
sudo pistar-mmdvmhshatflash hs_hat
This resulted in the error below.
Got NACK from device on command 0x43
Can't initiate chip erase!
Failed to erase memory
stm32flash Arduino_STM32_0.9
http://github.com/rogerclarkmelbourne/arduino_stm32
Using Parser : Raw BINARY
Une erreur est survenue lors du transfert du croquis
Interface serial_posix: 115200 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
My pistar was running firmware V1.4.17 but I noticed that the latest was V1.5.2 So I decided I should get the latest code and see how well that works. My attempts to upgrade where falling flat. I just kept getting the same error above.
Has it turns out it seems the easily upgraded software needed a secret handshake.
Use SSH to login to the pi-star.
Use the rpi-rw command to place the pi-star into read/write mode.
pi-star@pi-star(ro):~$ rpi-rw
Now execute the following command below to unprotect the flash on the MMDVM (this is the secret handshake, the secret key):
sudo stm32flash -k /dev/ttyAMA0
You should see something that looks like this:
pi-star@pi-star(rw):~$ stm32flash -k /dev/ttyAMA0
stm32flash 0.5
http://stm32flash.sourceforge.net/
Interface serial_posix: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (STM32F10xxx Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Read-UnProtecting flash
Done.
Then execute the command to upgrade the firmware to the latest:
sudo pistar-mmdvmhshatflash hs_hat
You’ll know it’s all good when the output shows success, something like this:
Using Parser : Raw BINARY
Interface serial_posix: 57600 8E1
Version : 0x22
Option 1 : 0x00
Option 2 : 0x00
Device ID : 0x0410 (Medium-density)
- RAM : 20KiB (512b reserved by bootloader)
- Flash : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote and verified address 0x0800c6d4 (100.00%) Done.
Starting execution at address 0x08000000... done.
Flashing your hs_hat modem complete, press any key to reboot your Pi-Star System.
Hope this helps others has it helped me.
Stu-M7SPI