As already mentioned in my last post LoRaWAN GPS Tracker Dragino LGT-92 and OwnTracks, the firmware of the Dragino LGT-92 GPS Tracker has to be updated using an ST-LINK/V2. The fine folks from sent me one to give it a try. Update 2020-06-10: The product is now available in the online shop: ST-LINK V2 Debugger Programmer für STM8 STM32.

Before continuing with the steps below, I strongly suggest to carefully read the user guide section "4. Upload Firmware" in LGT-92_LoRa_GPS_Tracker_UserManual_v1.5.5.pdf (page 24 and 38) and the changelog to better understand what's going on.

These are the steps I've taken to get my LGT-92 updated to firmware version v1.6.0 under Linux (the user manual only helps with Windows):

  1. Install openocd: Arch users can install it using pacman -S openocd, Ubuntu users with apt install openocd
  2. Download the firmware file from (choose the matching LoRaWAN frequency)
  3. Connect the LGT-92 to the ST-LINK/V2 and to your computer (see below how to exactly do that)
  4. Press the Reset button on the LGT-92 and run the following command (replace "EU868.hex" with the firmware file you've downloaded): openocd -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -c "transport select hla_swd" -f /usr/share/openocd/scripts/target/stm32l0.cfg -c init -c 'program EU868.hex verify reset exit'
    Note: I had to try that a few times as I wasn't sure when to exactly release the reset button and run the command
  5. Check that the output shows: ** Verified OK ** ** Resetting Target **. The output on my try showed some other errors, but in the end the firmware upgrade worked

To verify that the firmware is really upgraded, connect to the LGT-92 via serial console (see below) and send the command AT+VER. The manual also suggests to run AT+FDR to reset to factory defaults (reboot after that!). See DRAGINO_LGT92_AT_Commands_v1.5.3.pdf for a description of all the AT commands.

Please note that the firmware behavior and also the LoRaWAN payload changed significantly between version 1.4 and version 1.6 (see user manual and changelog for details). This also means that the payload decoder on The Things Network needs to be updated (source) and I had to adapt my Python script which sends the received data to OwnTracks (via MQTT) and to InfluxDB.

My hope is that with the newer firmware version the location reporting will be much more accurate. Let's see if this turns out to be true.

This is how I connected the LGT-92 to the ST-LINK/V2:

LGT-92 black -> ST-LINK/V2 STM32 Pin 20 (GND)
LGT-92 green -> ST-LINK/V2 STM32 Pin 7 (TMS_SWDIO)
LGT-92 white -> ST-LINK/V2 STM32 Pin 9 (TCK_SWCLK)
LGT-92 red -> ST-LINK/V2 STM32 Pin 19 (VDD)
ST-LINK/V2 STM32 connector pinout
Connection between LGT-92 and ST-LINK/V2

I'm not 100% sure if this is the correct cabling - but in the end it worked.

The user manual of the ST-LINK/V2 is available here: dm00026748-st-link-v2-in-circuit-debugger-programmer-for-stm8-and-stm32-stmicroelectronics.pdf, containing the full description of the pinout.

Connecting LGT-92 to UART

For having a serial console, an FTDI connector like the Mini USB UART FTDI Programm is needed.

I own an UartSBee V4, the connection looks like this:

LGT-92 black -> UartSBee GND
LGT-92 green -> UartSBee RX
LGT-92 white -> UartSBee TX
Connection between LGT-92 and UartSBee V4

Now a connection via f.e. with screen /dev/ttyUSB0 9600 can be used to see the console output or to issue AT commands.

Example of a booting LGT-92:

LGT-92 Device
Image Version: v1.6.0
LoRaWan Stack: DR-LWS-003
Frequency Band: EU868

[2119]***** UpLinkCounter= 0 *****
[2518]TX on freq 868300000 Hz at DR 5
[7574]RX on freq 868300000 Hz at DR 5
Rssi= -69

Join Accept:
ReceiveDelay1:1000 ms
ReceiveDelay2:2000 ms
Output on the serial console of a just booted LGT-92

References which helped me