The official ISP software (serial port burning software) FlashLoader Demonstrator does not support the stm32l01 series of microcontrollers. So how can we use the serial port to burn the program for this type of microcontroller through the serial port?
I recently did a project that required this, so I studied this method and shared it with those who need it. To prepare the tools, you only need the mcuisp (also known as flymcu) software and the serial port assistant.
Provide mcuisp software for lazy people mcuisp
After my experiment, mcuisp can program this microcontroller but cannot erase the chip. Later, I found that the erase instruction of this chip is different. Students who are interested can read this document AN3155 (USART protocol used in the STM32 bootloader) and search it on Baidu.
So our task now is to find a way to erase this chip and then download it through the mcuisp software (my idea is that it is okay to use the existing tools directly after knowing the principle). The AN3155 document introduces the usage of each instruction in detail. We mainly read the erase instruction part
This chip supports Extended Erase Memory Command, but it does not support the advanced commands in this command, so if you want to erase this chip, you must use the most troublesome step. Erase page by page. My chip has 16k flash and each page has 128b, so there are a total of 128 pages that need to be erased. If you send commands one by one, at least 129 commands are required. So I used Qt to write a serial port host computer to help me complete this tedious process. I am not very proficient in using Qt and basically have not seen the threshold. Here is a solution. If you want to learn from it, please reply below this post and I can share the main code.
In addition, the chip I use supports user-defined boot options, so it is more convenient to use with this. The code for selecting the boot area is as follows:
void BOOTCONF_User() //Determine where the system is booted from. If booting from systemflsh, change the option byte to boot from //Flash program memory
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t tmp = 0U, tmp1 = 0U;
if (LL_SYSCFG_GetBootMode() == LL_SYSCFG_BOOTMODE_SYSTEMFLASH)
{
tmp = OB->USER & (~0XE000);
tmp |= (1u << 15);
tmp1 = (~tmp) << 16;
tmp |= tmp1;
HAL_FLASH_OB_Unlock();
status = FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
{
OB->USER = tmp;
FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
}
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
}
}
void BOOTCONF_System()//How to trigger your own definition after receiving the programming instruction to let the chip enter the system bootloader
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t tmp = 0U, tmp1 = 0U;
tmp = OB->USER | 0X00E000;
tmp &= 0X00BFFF;
tmp1 = (~tmp) << 16;
tmp |= tmp1;
HAL_FLASH_OB_Unlock();
FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
{
OB->USER = tmp;
FLASH_WaitForLastOperation(FLASH_TIMEOUT_VALUE);
}
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
}
Previous article:Experience in tuning the serial port ISP of STM32
Next article:Several issues with stm32j_link and serial port download
Recommended ReadingLatest update time:2024-11-16 13:07
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- 51 Single Chip Microcomputer Basic Experiment and Comprehensive Practice (Edited by Li Zuojin, Nie Ling, and Zhai Yuan)
- MCU Principles and Interface Technology C51 Programming (Edited by Zhang Yigang)
- STC MCU Principles and Applications: Analysis and Design from Devices, Assembly, C to Operating Systems: A Three-Dimensional Tutorial (He Bin)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications