STM32cube Programmer and bootloader

Posted by

In this article, We will discuss Installation of STM32cube programmer. Explanation of programming options, Bootloader & DFU driver installation in Wiindows 10 with Nucleo-L4R5ZI board.

Why we need Bootloader in STM32 ? 

So far we have  used ST-LINK in all the STM32 related material . The ST-LINK part was discussed during STM32 Nucleo-L4R5ZI board introduction. This part itself one small embedded product with MCU , USB interface and other components. But no one will prefer to integrate such debugger interface in final product. The reason is obviously to reduce BoM (Bill Of Material) cost.

One can find equipment to do mass programming of STM32 devices. That will fulfill the basic application programming requirement . Is that sufficient ?

No, Think about the situation when your hard-disk crashes, BootROM plays an important role in that case. Similarly we need some bootloader in embedded system as well which can be used to update system software in the field.  STM32 devices have inbuilt bootloader which can be activated based on certain hardware & software configuration.  Additionally, You may same some power as well by using UART interface.

How to Enable Bootloader in STM32 Nucleo board ?

Here I will share the method I tried for STM32 Nucleo-L4R5ZI board. STM32 bootloader supports many interfaces such as UART, USB , CAN etc to communicate with host PC and host based software can program the device without debugger interface.

Step 1:  Installation of STM32cube Programmer 

I have installed STM32cube Programmer on Windows 10 host.  This is a Free software utility available at STM32cube Programmer. This utility can connect to device using both ST-Link and bootloader interface.

So if bootloader is running , Use bootloader specific connection interface for communicating with target. In case of application running in the target, You may use ST-LINK interface. The USB interface used DFU(Device Firmware Upgrade) protocol . Several  installation issues reported  for this in Windows 10.

Step 2:  Installation of  Bootloader Driver

After installing STM32cube programmer, I executed the  STM32Bootloader.bat file,   given at location below, in CMD window with admin privileges.

C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\Drivers\DFU_Driver

and rebooted my PC. I was able to find the STM32 BOOTLOADER in Windows Device Manager after checking View->Hidden Devices

 

Step 3:  Target Boot Configuration Setup

I discussed about various Boot configuration options .

 

For Bootloader , we can use following settings :

a: nBoot1 or FLASH_OPTR[23]   = nSWBOOT0 or FLASH_OPTR[26] = 1 using STM32 ST_LINK utility  

b: BOOT0 =1 by using a jumper between BOOT0 (PH3 pin) and VDD

Step 4:  Identify the Bootloader Interface

You should identify the Bootloader to Host connection interface such as USART, USB etc. If you are using USART(RS232) option, Take a precaution about signal voltage levels . I am using USB interface .

 

STM32 Cube Programmer Demo

Note : If you are not able to control baremetal debugging due to bootloader, You need to just make nBoot0_SW_cfg = 0 using  ST Link Utility tool.

You may also like video on this STM32cube Programmer and Bootloader

Reference

AN2606 and AN3155  from ST

Embedded System Developer Kit

Thanks for reading till end. Appreciate any  feedback regarding this article. If you found this useful, Please share  in your network.

You may  find interesting topics at HowTo

Also subscribe  Embedkari for other interesting topics. .

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.