Performing Firmware Upgrade Without a Programmer: In-System Programming (ISP) - Page 1
Forum section: electronics / general

author: danchouzhou
author_rank: Contributor
timestamp: May 20, 2025, 02:14:32 pm
content: After introducing thecontactless engine tachometerlast time, you may want to know how to flash the 003Clock firmware to a tachometer program? This article will introduce how to update the firmware without a programmer.Method of Firmware ProgrammingUsing aNu-Link-PROdebug probe. If you frequently work on projects using Nuvoton MCUs, it’s highly recommended to keep one on hand - it’s very useful. It's available fromNuvoton Direct, the official online store, ensuring a reliable supply. (Currently, registering an account on the NuForum grants a 10% discount.)Utilize the built-inNu-Link-Me on a development board. If you already have a Nuvoton development board, check out this article:Programming Nuvoton chips by the on-board debug probe Nu-Link2-MeDon’t have either of the options above? Do you really need to spend money on a programmer? Don’t worry, I’ve already thought of a solution for you! During packaging, I preloaded theISP bootloaderinto the LDROM of the N76S003 chips. You only need a USB to UART adapter (USB to Serial, aka. USB to TTL, FTDI, PL2303 etc.) paired with Nuvoton’s official tool, NuMicro ISP Programming Tool, to flash firmware onto the chips.What is ISP?ISP stands for "In-System Programming," meaning firmware burning can be performed without removing the chip from the “system” - embedded systems. Which consist of various elements, including hardware, peripheral circuits, firmware, communication interfaces, and software. ISP allows firmware programming and updating directly within the system.Benefits and Practical Applications of ISPWhen designing and selling a product, you may need firmware updates to improve functionality. You can't expect customers to buy a programmer and tearing the product just to update the firmware! Instead, updates should be performed via the device’s built-in communication interface.ISP solves this issue well. For instance, gaming keyboards and mice manufacturers often release firmware updates to fix bugs or add new features. To update, users run a program on their PC while the keyboard or mouse enters ISP mode via a special key combination or unplugging/replugging the USB connection, allowing the device to receive the update through USB. This enables users to update firmware themselves without a programmer or opening the device.The 003Clock follows the same principle. It was designed as a high-flexibility development platform with a Nuvoton 1T 8051 microcontroller with a four digits seven-segment display, encouraging creativity.Using NuMicro ISP Programming Tool for Firmware UpdatesThe 003Clock chip already preloaded ISP_UART1 bootloader. Simply connect a USB to UART adapter to the N76S003’s UART1 to update the firmware. To locate UART1, check the datasheet’s Pin Configuration, revealing that TXD and RXD are at P1.6 and P0.2, sharing pins with ICE_DAT and ICE_CLK.Next, observe the 003Clock circuit board - the right-bottom 5-pin programming interface is labeled DAT and CLK, which correspond to UART1's TXD and RXD.Connect USB to UART RXD to N76S003 TXD (DAT)Connect USB to UART TXD to N76S003 RXD (CLK)Using a 5-pin header, neatly align the USB to UART connections. However, don’t plug in the 003Clock immediately! The ISP program is designed to wait briefly after powering on for a PC handshake. If not completed within the time limit, the chip exits ISP mode and automatically runs the APROM program.Next, open the NuMicro ISP Programming Tool, select UART as the ISP interface, and pick the corresponding COM port for the USB to UART adapter. Click Connect, allowing the ISP Tool to wait for 003Clock to handshake. You can download the NuMicro ISP Programming Tool here.https://www.nuvoton.com/tool-and-software/software-tool/programmer-tool/After plugging in the pre-arranged header, a successful connection will be displayed. Select the APROM file, enable options to burn APROM and Reset and Run. Click Start to complete the firmware burning process.Mechanism of ISPIf everything goes smoothly, you've successfully burned the firmware. Now, let's deep into the technical details behind ISP.For an MCU to have ISP functionality, it needs an ISP program that controls its communication interfaces, sends/receives data, and manages the Flash Memory Controller (FMC) to read/write the program memory (Code Memory). This essentially forms a bridge between the communication interface and the program memory.003Clock executes the ISP program upon powering on, this process just like the key combinations or USB reconnects of gaming keyboard mentioned above.Typically, the program memory is partitioned into normal execution mode and ISP mode to prevent bricking if an update fails (e.g., disconnecting mid-update). Most of the Nuvoton MCUs support memory partitioning, allowing the normal program (APROM) to reside in APROM while the ISP program is stored in LDROM. For example, the N76S003 shares an 18 KB program memory between APROM and LDROM, and the Config bits define their allocation sizes.This is a supplementary explanation of the terms APROM and LDROM. APROM stands for "Application Program ROM", typically has a larger memory space and is used to store application programs that run in normal execution mode. LDROM stands for "Loader ROM", carrying the meaning of "loading" or "guiding." The programs stored in LDROM can determine whether to "guide" the chip to execute ISP (In-System Programming) or APROM content, hence the name LDROM.Adding ISP to your ProductsMost Nuvoton BSP sample codes include ISP examples, complete with compiled executables for direct burning into LDROM. These can be used alongside NuMicro ISP Programming Tool.Here are four step to program the ISP code:Select the LDROM ISP program file in ICP Tool (if an APROM program exists, select it as well)Set Config bits to boot from LDROMEnable options to burn APROM (if applicable), LDROM, and Config bitsClick Start to begin burningAdditional Notes The N76E003_BSP V2.0 was recently released (now supporting Keil C51 / IAR / SDCC). However, the ISP example appears to have some bugs, preventing direct use. I’ll report this to their employee later. Additionally, 003Clock’s ISP program has been optimized - reducing 2172 Bytes to 1942 Bytes, allowing LDROM allocation of 2 KB, leaving 16 KB for APROM. You can find the modified source code on GitHub:https://github.com/danchouzhou/003Clock/tree/main/firmware/ISP_UART1ConclusionsNew blank chips require Nu-Link debugger and NuMicro ICP Programming Tool for APROM & LDROM programming.To use ISP, the ISP program must be burned into LDROM, with Config bits set to boot from LDROM.NuMicro ISP Programming Tool is used for ISP-based firmware burning.The ISP mechanism uses the LDROM ISP program to exchange data via communication interfaces (e.g., UART) and write received firmware to APROM.