H663/H512 families firmware upgrade procedure for Linux

SpringCard H663 and H512 families are a group of NFC devices / contactless smartcard readers. This document explains how to upgrade their firmware, using Linux.

IMPORTANT DISCLAIMER:

Please note that SpringCard is not responsible for any procedure that end user performs. YOU’RE FOLLOWING THIS PROCEDURE AT YOUR OWN RISK.

GETTING STARTED

For this howto, we will assume that you have some Linux basis.
All this demonstration has been done as root on a Linux Debian 10.10 Operating System and on a Raspberry Pi with Raspbian GNU/Linux 10 (buster).

You can find all the relevant files at the end of this tutorial (Python script).

REQUIREMENTS

Install all the relevant Linux packages (PCSCLite, Python3, Python3 PCSC library and dfu-programmer utilities):

apt-get install pcscd pcsc-tools python3 python3-pyscard dfu-programmer

Check if your device is visible

Using pcsc_scan:

Using lsusb:

Enable SCardControl commands in PCSC lite

First of all, locate PCSC lite Info.plist configuration file:

find / -name "Info.plist"

Edit this file (vim, nano, ...) and look for the ifdDriverOptions.
Bit 0 must be set to 1 to allow SCardControl commands:

Modifiy this file if that's not the case and restart pcscd:

/etc/init.d/pcscd restart

Check your device's current firmware version

Use python3 sc_restart_dfu.py --getversion to retrieve the current firmware version.
Please note that you must place a card in/on your device for this operation.

Donwload the latest firmware version

Simply use :

wget -O h663_latest.hex https://files.springcard.com/api/latest-firmware.php?p=uc3b0256_rc663_h663

Restart your device in DFU mode

Use python3 sc_restart_dfu.py to restart your device un DFU mode.
Please note that you must place a card in/on your device for this operation.

Unplug/plug your device if this one is not visible after the DFU reset command.

Flash the new firmware using dfu-programmer

dfu-programmer at32uc3b0256 erase
dfu-programmer at32uc3b0256 flash --suppress-bootloader-mem h663_latest.hex
dfu-programmer at32uc3b0256 start

Check firmware version again

RESSOURCES