The overall requirement is that the host Master sends data to the slave Slave through the CAN interface. After receiving the application APP, the slave overwrites the original application area with the received data, thereby realizing the online upgrade of the Master to the Slave.
Here we first introduce IAP, and have an understanding of the overall implementation of IAP, which is convenient for subsequent development. The Atomic STM32 development board is used as a reference to introduce the IAP function.
To implement IAP, two project codes are required. The first is called the Bootloader program, and the second is called the APP program. The Bootloader is responsible for guiding the APP program to start, and when the APP needs to be updated online, it receives the APP file sent by the host and overwrites the original APP with the received APP.
For the specific content of IAP, please refer to Chapter 53 of the Development Guide of the Atomic STM32 Development Board.
The following is an experiment I conducted after I had a general understanding of IAP. 1. Write a bootloader program test program to boot the APP in the specified location. 2. Modify an original application so that it can be booted with the bootloader. 3. Download the bootloader and APP separately through the jlink downloader.
1. Bootloader program.
The main code is as follows. After the running lights, execute the command to jump to the APP area
- int main(void)
- {
- delay_init();
- LED_Init();
- LED1 = 0;
- delay_ms(200); //delay
- LED2 = 0;
- delay_ms(200); //delay
- LED3 = 0;
- delay_ms(200); //delay
- LED4 = 0;
- delay_ms(200); //delay
- LED1 = 1;
- delay_ms(200); //delay
- LED2 = 1;
- delay_ms(200); //delay
- LED3 = 1;
- delay_ms(200); //delay
- LED4 = 1;
- delay_ms(200); //delay
- iap_load_app(FLASH_APP1_ADDR); //Execute FLASH APP code
- }
- #define FLASH_APP1_ADDR 0x08003C00 //The first application start address (stored in FLASH)
- //Reserve the first 15K of space as the bootloader area
2. APP program area.
Complete the relocation of the interrupt vector table. Project configuration download location
- int main(void)
- {
- SCB->VTOR = FLASH_BASE | 0x3C00;
- /* Infinite loop */
- while (1)
- {
- OSInit();
- OSTaskCreate(Start_Task,
- (void*)0,
- &Start_Task_Stk[START_TASK_STK_SIZE-1],
- START_TASK_PRIO);
- OSStart();
- return 0;
- }
- }
The address of jlink download is configured to start at 0x0800 3C00. This way the bootloader area will not be erased during downloading.
Finally, download the bootloader and APP projects separately under Keil. You can see that at the end of the bootloader running light, the APP program is started.
Previous article:STM32 learning record 19 timer trigger ADC
Next article:STM32 learning record 17 serial port one-click download
Recommended ReadingLatest update time:2024-11-16 13:50
- Popular Resources
- Popular amplifiers
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
- Outsourcing Motor Drive Control Project
- MicroPython Hands-on (20) - Three-axis acceleration of the control board
- CXN2000-6KVA power supply maintenance case
- Design of wireless sensor nodes based on the characteristics of wireless sensor networks
- This circuit cannot maintain constant current. Please analyze it.
- LSM6DSL 3D Accelerometer and 3D Gyroscope PCB Package and Code
- Ultrasonic Flow Measurement EVM
- The TS3DV642A0RUAR chip specification says it does not support 4K 60HZ, but the Ruiping can support 60HZ. Why?
- 【Xingkong Board Python Programming Learning Main Control Board】 2. Power on and Mind+ Graphic Lighting and Music Clock Operation Evaluation
- A comprehensive overview of electromagnetic interference suppression technology