How to upgrade RAK4270 FW using RAKDAP1 and recover it when upgrading fails

Issue:

Setup:

Server:

Details:
Hello,

I want to upgrade the firmware of RAK4270 Breakout Board from v3.3.0.16 to the latest version. I downloaded the latest firmware file, RAK4270_Latest_Firmware.zip and it’s version is v3.3.0.17.

As Quick Quick Start Guide of RAKDAP1, I installed pyOCD and stm32l071kb package for RAK4270. (OS: Ubuntu 20.04, pyocd: 0.32.1)

And then I executed command as following to upgrade firmware;

pyocd flash -t stm32l071kb RAK4270_v3.3.0.17_App_20210525.bin

But there were following error messages;

0000520:CRITICAL:main:Target type stm32l071kb not recognized. Use ‘pyocd list --targets’ to see currently available target types. See …
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/pyocd/board/board.py”, line 75, in init
self.target = TARGETself._target_type
KeyError: ‘stm32l071kb’

When I executed pyocd list --targets, there was no stm32l071kb. However, I found that there were stm32l071kbtx and stm32l071kbux packages. So I tried stm32l071kbtx/stm32l071kbux instead of stm32l071kb as followings;

pyocd flash -t stm32l071kbtx RAK4270_v3.3.0.17_App_20210525.bin

The result of execution:

0000500:WARNING:cmsis_pack:Page size (1024) is larger than sector size (128) for flash region IROM1; reducing page size to 128
0000649:INFO:load_cmd:Loading /home/philnet/lora/rak/4270/RAK4270_Latest_Firmware/RAK4270_v3.3.0.17_App_20210525.bin
[==================================================] 100%
0035672:INFO:loader:Erased 100736 bytes (787 sectors), programmed 100736 bytes (787 pages), skipped 0 bytes (0 pages) at 2.81 kB/s

After that, RAK4270 Breakout Board does not respond. I guess the reason is a mismatch between pyosd package and the firmware.

My questions are

  1. Is it possible to recover RAK4270 Breakout Board which does not respond?
  2. How to upgrade RAK4270 Breakout Board using RAKDAP1?

Welcome to RAK @philnet ,

There are some changes in the pyocd causing the error.

Few comments I have which you can try.

  1. You must use RAK4270_v3.3.0.17_Boot+App_20210525.hex and not the .bin file.
  2. You must use stm32l071kbux for the target.

Another option you have is use ST-LINK to upload the .hex FW.

Actually, if you just want to update to v3.3.0.17, the RAK DFU Tool should be enough and you can do it via UART pins.