Search code examples
androidandroid-ndkusbstm32dfu

STM32 Device Firmware Upgrade (DFU/DfuSe) from Android


I have an STM32F4 microcontroller connected to an Android (4.4) USB Host port. I would like to do a firmware upgrade of the microcontroller from the Android device.

===================                           ===================
|   Android 4.4   | <=======================> |   STM32F405xx   |
|     Device      | USB Host      USB Device  | Microcontroller |
===================                           ===================

Traditionally, STM32 microcontrollers can have their firmware upgraded using the PC tool called DfuSe Utility provided by ST. But I need to do this from an Android device instead. The source for their tools are provided.

Questions:

  1. Can the firmware for the microcontroller be upgraded using the standard USB Host libraries from Android in Java?
  2. Or does this need to be done using the NDK, and port the DfuSe source? If so, which libraries should be used to access USB from the NDK?

Which direction should be taken and how can this be done?


Solution

  • We ended up creating our own solution to program a STM32 microcontroller directly from Android over USB using DFU without using the NDK. We open sourced the project here:

    https://github.com/UmbrelaSmart/android-stm32-dfu-programmer