Recently, I encountered such a problem when supporting a customer: the customer was making his own secondary boot loader and using the LPC54608 IAP function. When programming page0 in sector0, it always failed (returning 0x21 error code), but programming any other page There is no problem (the customer's code is in the last sector, no programming).
The problem seems strange at first glance, because only page0 will have problems, and there will be no problems with operations on other pages, and there will be no problems with erasing page/sector. Only programming operations will go wrong.
After a short discussion, the problem was finally locked on the check sum verification mechanism of the LPC interrupt vector table: LPC (except for the relatively new LPC5500 series) basically needs to fill in the 8th position of the interrupt vector table. Checksums of the first seven interrupt vectors. For details about the checksums, please refer to the article mentioned at the beginning.
In the .bin file compiled by Keil, this checksum is not automatically added by default, so whenever IAP is called to change to page0, the IAP program will check this checksum internally. Once the checksum is wrong (such as all 0 ) will return failure.
The solution is also very simple, just calculate the checksum every time you program page0. The code for calculating the checksum is given directly here:
adr is the programming address. When adr is 0, the page0 area is programmed. The code in the red box calculates the checksum and fills the checksum into the 8th position of the interrupt vector table.
After adding this code to calculate the checksum, the problem is solved. This problem is common in almost all old LPC models except the LPC5500 series. I hope this article will be helpful to everyone in developing LPC MCUs!
Previous article:RS-485 bus realizes smart home network system
Next article:Methods to Investigate HardFault Using SAU and Secure AHB Controllers
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- I am a novice learning ESP8266 infrared remote control. I have searched around for micropython and it seems that there is no library related to infrared transceiver. Does anyone know...
- Recommended high voltage mosfet models
- Cheap_flash_fs (FAT high-end version) -- embedded FAT16/32 file system free source code download
- Single-cell lithium battery fuel gauge
- CS5090 5V USB input charges 2 lithium batteries, with path management application, which can realize the function of "charging and discharging at the same time".
- Free review: National Technology low power series, N32L43x is now available for testing
- DSP interrupt system and its application
- Electrostatic Shielding
- In the second week after returning to work, I received: resignation form and notice of termination of labor contract!
- "Intel SoC FPGA Learning Experience" + Three mmap Examples in Eclipse under Linux