In this tutorial, I want to show you how to flash the code using a mobile phone application.

Nearly every embedded system needs the ability to have its firmware updated in the field to add new features or fix bugs. However, firmware field updates can be challenging as a developer must either program their bootloader or procure one from a third-party component supplier. There is an easier route: this piece explains how to use the device firmware update feature that is built into many microcontrollers

The application is devoted to updating the flash memory of microcontroller Stm32 by using programmer St-Link

The major advantage of the application is when we don’t have a computer we can flash the code. Without using a laptop or desktop we can flash the code.

By connection fallowing pins 

  • GND
  • VCC


  1. First you need a mobile device with OS Android
  2. 2nd stm32 controller 
  3. 3rd stlink_v2 module as shown above picture.
  4. 4th USB cable and connectors.
  5. 5th USB-OTG cable
Note: Your mobile device must support USB-OTG.

Supported stm32 family

  • STM32F05x/F030x8
  • STM32F07x
  • STM32F10xx Medium-density
  • STM32L05x/l06x/L010
  • STM32L100x8/l15xx8
  • STM32F2xx
  • STM32F301x4-x6-x8/F302x4-x6-x8/f318xx
  • STM32F401xE
  • STM32F405xx/407xx
  • STM32F415xx/417xx
  • STM32L43x
  • STM32G0x1
  • STM32G47x/g48x

Introduction about ST-LINK/V2 

The ST-LINK/V2 is an in-circuit debugger and programmer for the STM8 and STM32 microcontroller families. The single wire interface module (SWIM) and JTAG and Serial Wire Debugging (SWD) interfaces are used to communicate with any STM8 or STM32 microcontroller located on an application board.

Introduction about USB OTG 

USB On-The-Go (USB OTG or just OTG) is a specification first used in late 2001 that allows USB devices, such as tablets or smartphones, to act as a host, allowing other USB devices, such as USB flash drives, digital cameras, mouse or keyboards, to be attached to them. The use of USB OTG allows those devices to switch back and forth between the roles of Host and Device. A mobile phone may read from removable media as the Host, but present itself as a (USB Mass Storage) Device when connected to a host computer.

Procedure Download and Install Application

  • 1st install the stlinkp application on our android mobile phone.
  • The application is available for free install from the googleplay market.
  • Next, it needs a board with a microcontroller that will be updated
  • I have board Nucleo with microcontroller Stm32F303
  • Next, it is needed programmer St-Link

It can be as an original programmer from STMicroelectronics company Such and its china clone I’ll use the programmer which embedded in board Nucleo. Programmer should be connected to the mobile device via USB-OTG cable So your device must support OTG technology.

So let’s start

Run the application

Connect the cable You can see that green indicator turn on. This indicates that the programmer is defined by the application successfully. Just Red power LED is shining on the board now.

None no other signs of life you could see in the microcontroller. So let’s animate it and ask it to blink with a green LED, which I connected to the board especially. The select file of firmware, which should be previously loaded in the memory of the phone

Firmware can be in format fele_name.HEX, just in raw binary. I’ve prepared my demo version in format b_16_12 HEX.
Select it.

Start the process of uploading. Get a message about successful uploading. The board has come to life and led is blinking. So the process has passed well. As you see the process is easy enough

That’s all for me.

If you have some propositions, questions or criticisms. You can leave it in the comments. I’ll respond to them as far as possible. Thank you for viewing. Good luck to you.

By Devilal

Leave a Reply

Your email address will not be published. Required fields are marked *