Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

LPC2000 Flash memory and its programming

All flash memory of LPC2000series microcontrollers is arranged as two interleaved banks. But user sees it as one memory space. All flash memory appears to user as series of 8K sectors. These sectors can be written and erased individually. There are several methods how flash memory of ARM can be programmed. One and easiest way is to use built in bootloader. The code is downloaded by bootloader via USART0 to RAM and then it is programmed to Flash. There is a tool for this – Philips ISP Utility

that works under Windows environment.

Another method is to use JTAG to program flash memory. This method is usually used from debugging environment. JTAG is faster than ISP – reaches up to 400kB/s.

Third method is ability to reprogram Flash memory sectors using application commands that are on chip. This feature is handy for updating code in a given sections. This is so called Field Updating.

LPC2000 bootloader

After each reset microcontroller is mapped to boot mode, what means reset vector jums to bootloader entry point at address 0x7FFFFFFF. After program enters bootloader there is many checks performed. Firs of all it checks if it was har or soft reset. If it was hardware reset, then logic level of P1.4 is tested. If it is LOW, then Bootloader command handler starts. If software reset occurred (watchdog or P1.4 is high), then menas that there is no programming request. Averytime before program starts being executed bootloader checks is there a valid program in flash. Thisis done by checking program signature (every program has it). Signature is word width and stored in unused location in the ARM7 vector table at address 0x00000014. Program signature is two’s compliment of the checksum of the LPC2000 vector table. Without program signature user program wouldn’t run.

Few words about LPC2000 flash ISP utility

LPC2000 flash utility is a software which is used to program LPC2000 series ARM microcontrollers:

LPC2101, LPC2102, LPC2103, LPC2104, LPC2106, LPC2106, LPC2114, LPC2114, LPC2119, LPC2124, LPC2129, LPC2131, LPC2132, LPC2134, LPC2136, LPC2138, LPC2141, LPC2142, LPC2144, LPC2146, LPC2148, LPC2194.

Programming is done using RS232 serial port. As we mentioned LPC2000 series microcontrollers comes with boot-loader which is used to program Flash or Ram memories and perform other operations like erasing, editing memory sections. Bootloader has an algorithm which detects incoming ISP connection, detects baud rate automatically.

When starting ISP after reset P0.14 has to be pulled down what means that microcontroller is ready to accept ISP commands. Otherwise keep P0.14 pin pulled high to avoid unintended ISP entry.

Lets take a look at main screen of LPC2000 flash utility:

LPC2000_screen

Firs of all you have to power up your target board, connect serial cable to PC. Then in a screen select COM port number and baud rate. If you use automatic ISP entry mode, then check DTR/RTS. Target board has to be designed to be able control DTR and RTS lines (P0.14 pin and RESET pin). Otherwise use manual entry mode.

Enter crystal frequency of target board in kilohertz’s. After this press “Read Device ID” to make sure that device is detected correctly. Part ID and boot-loader ID is detected. If successful you can now start programming you microcontroller.

Open hex file and press “upload to flash” to send code to microcontroller. “Compare flash” button is used to compare original hex file contents with uploaded. This operation is possible if checksum is part of hex file already.

Checksum can be generated as follows:

Open buffer menu and select “Flash buffer operations”:

LPC2000_Flash

Press “load hex file” and select hex file you need to upload to microcontroller.

Press “Vector Calc” to generate checksum which will be located at the address 0x14. You will notice how this area updates after you press this button. Now you can save hex file back to its location by pressing “Save Hex File”.

Now press “Download Flash” to download hex data from microcontroller.

In a main window press “Compare flash” to compare flash contents and original hex file.

Flash Utility allows SRAM buffer operations. You can download microcontroller RAM contents, modify and send back to microcontroller.

You can also run program code from selected address location, fill buffer with some values and so on.

One Comment:

  1. program for philips flash utility software

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.