2.x firmware and compiling

OHS 2.x gateway has Travis Continuous Integration for its GitHub repository. CI performs a build on every commit that is pushed to it, and creates firmware related to every new commit. This means, that the latest, and also historical firmware are now available for download directly in GitHub:
https://github.com/vysocan/OHS_2-gateway/releases 

Binary files .bin can be directly used for firmware upgrade.

Firmware update:

Beside standard ST-Link interface gateways 2.x have, since software version 1.2,  new user convenient way of upgrading firmware without any external programmer. As STM32F4xx devices include built in USB DfuSe bootloader, there is an option in shell interface to boot the device to dfu mode, and then upgrade the firmware directly via USB cable.

DFU tools:

dfu-util  is a simple multi-platform command line tool that can upload binary data directly to flash.

List DFU ready devices via: dfu-util -l

Example output of gateway 2.x, most important is the 'alt=0, name="@Internal Flash  ' descriptor that we gonna use:

Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-6", alt=3, name="@Device Feature/0xFFFF0000/01*004 e", serial="336A34763437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-6", alt=2, name="@OTP Memory /0x1FFF7800/01*512 e,01*016 e", serial="336A34763437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-6", alt=1, name="@Option Bytes  /0x1FFFC000/01*016 e/0x1FFEC000/01*016 e", serial="336A34763437"
Found DFU: [0483:df11] ver=2200, devnum=12, cfg=1, intf=0, path="3-6", alt=0, name="@Internal Flash  /0x08000000/04*016Kg,01*064Kg,07*128Kg", serial="336A34763437"

Flash the firmware via: dfu-util -a 0 --dfuse-address 0x08000000 -D ch.bin

Or flash the firmware, and reset gateway via: dfu-util -a 0 --dfuse-address 0x08000000:leave -D ch.bin

STM32CubeProgrammer is also multi-platform tool but with graphical user interface. One downside is that you need older Java version installed to run it, but once you have it it will work nicely.

DFU howto:

  1. Connect your laptop/PC via USB cable to gateway. Status LED on gateway should change to short rapid flashes.
  2. Open any terminal emulation program like Putty and open serial connection to new enumerated USB device. On Linux it will be ACM0.
  3. In the terminal issue command 'boot dfu'.
  4. The gateway should close the USB connection, terminal will exit, or close, and the status LED will stop blinking.
  5. New USB device should be enumerated as 'STMicroelectronics STM Device in DFU Mode'
  6. Use any of DFU tool to list, connect and to download(in terms of to download a file to a DfuSe device) firmware into gateway.
  7. Reset the gateway via onboard reset button.

DFU hints:

Submitted by Charles: On Windows 10 there might be problems with the command line dfu-util tool not recognizing the device. If you have this issue too, then the following solution worked for me (It replaces the USB driver with an alternate version):
https://www.hanselman.com/blog/HowToFixDfuutilSTMWinUSBZadigBootloadersAndOtherFirmwareFlashingIssuesOnWindows.aspx

No comments:

Post a Comment