Flashing New Firmware.
The final step is to program the compiled and linked image into the microcontroller's flash memory. There are several ways that this can be done in the NXP processors; here we use the In Circuit Programming (ICP) technique.
To do this, we have to reset the processor, and pulse the PDA and PCL signals. The same hardware is used as for reading the flash program, just using different ICP commands. In fact, we use the same Arduino program, using different commands to that user interface. The main menu is as follows:
After entring ICP mode with the R command (it may take a few goes), the 'p' command should be selected. After entering 'Y' to "Are you sure?", the Arduino will then be waiting for a valid hex program. You should turn off local echo if it's on at this point. Next, from your terminal program, select the command to send an ascii file. For Tera Term, this is the File Send File command. Choose the hex file, and press OK. Any problem, and the Arduino will display "?". If the program loads correctly, it will display "Done!". The image is being programmed as it is sent, so if there is an error, you will have an incomplete image. The program erases while writing, so there is no need to bulk erase the image first. When you see the "Done!" message, the image should in fact be sent. Use the 'o' (ordinary reset) command to reset the microcontroller in the charger, and you should see the front panel LED flashing indicting that the new firmware is running.
The file ICP.zip containing the Arduino program is in this post: Hardware for Reading/Writing the Firmware .
The final step is to program the compiled and linked image into the microcontroller's flash memory. There are several ways that this can be done in the NXP processors; here we use the In Circuit Programming (ICP) technique.
To do this, we have to reset the processor, and pulse the PDA and PCL signals. The same hardware is used as for reading the flash program, just using different ICP commands. In fact, we use the same Arduino program, using different commands to that user interface. The main menu is as follows:
Code:
[FONT=Courier New]h - Command help d - Read ID
u - Read User Configuration v - Read Boot Vector & status
f - Write user config UCFG1
w - Write boot vector b - Set Status Byte
c - Clear Security Byte g - Erase Global
r - Read Security Bits m - Read Memory
e - Erase Sector 7 K - Clear Configuration Protection
G - Global CRC P - Page CRC
S - Sector CRC
R - Enter ICP o - Ordinary reset to user code
i - prog memory dump j - prog EEPROM peek
k - read max current EEPROM l - write max current EEPROM
a - Clear Status Byte p - program from hex file
[/FONT]
After entring ICP mode with the R command (it may take a few goes), the 'p' command should be selected. After entering 'Y' to "Are you sure?", the Arduino will then be waiting for a valid hex program. You should turn off local echo if it's on at this point. Next, from your terminal program, select the command to send an ascii file. For Tera Term, this is the File Send File command. Choose the hex file, and press OK. Any problem, and the Arduino will display "?". If the program loads correctly, it will display "Done!". The image is being programmed as it is sent, so if there is an error, you will have an incomplete image. The program erases while writing, so there is no need to bulk erase the image first. When you see the "Done!" message, the image should in fact be sent. Use the 'o' (ordinary reset) command to reset the microcontroller in the charger, and you should see the front panel LED flashing indicting that the new firmware is running.
The file ICP.zip containing the Arduino program is in this post: Hardware for Reading/Writing the Firmware .