PROG12Z and the 9S12XE Microcontroller Family
In-Circuit Flash Programming , MC(9)S12(X) Microcontrollers Add commentsP&E's flash programming software PROG12Z now supports the Freescale MC9S12XE family of microcontrollers.
The MC9S12XE family of microcontrollers comes with unique flash memory called D-Flash that can be allocated for Emulated EEPROM (EEE) which mimics the small sector size and endurance of real eeprom. Before you can program the D-Flash or EEE, the D-Flash must be configured with the "Full Partition" command PROG12Z. In this article, I will discuss how to program the MC9S12XE100 using PROG12Z.
Overview
The size of the D-Flash on the MC9S12XE can be up to 32KB or 128 sectors of 256 bytes each. You can allocate up to 4KB or 16 pages of 256 bytes each to be used for EEE. Please see Freescale application note AN3490 for a more detailed overview of the EEE implementation. There are two parameters that control how the software configures the memory: DFPART and ERPART.
DFPART = Number of D-Flash sectors reserved as User D-flash (128 total)
ERPART = Number of pages reserved for EEE (16 total)
The two parameters are required to meet two size conditions to be valid:
1. (128-DFPART) / ERPART >= 8
2. (128-DFPART) >= 12 if ERPART==1
The following table shows how the flash memory can be allocated towards D-Flash and EEE. The arrows indicate that any number in that range is a valid amount of sectors for D-Flash. DFPART and ERPART are in hexadecimal notation.

Programming
Open Prog12z and connect to the target board. After entering background mode, the software will prompt you for an algorithm. There are two seperate algorithms for D-Flash and EEE. The D-Flash algorithm is "Freescale_9S12XEP100_1x16xmax16k_max32k_Linear_User_Dflash.12P". The EEE algorithm is "Freescale_9S12XEP100_1x16xmax2k_max4K_EEPROM_linear_1k_page.12P". After selecting your S19 file and before programming, execute the Full Partition (FP) command. The software will prompt you to enter a hexadecimal parameter that is the DFPART and ERPART parameters combined.
Examples:
"8000" - Enables 80 sectors of D-FLash and 0 pages of EEE
"5505" - Enables 55 sectors of D-FLash and 5 pages of EEE
"0010" - Enables 0 sectors of D-Flash and 10 pages of EEE
Please note that setting up the memory configuration using the FP command will erase all the contents of both D-Flash and EEE. If you get the error message "Started. Error during .12P specified function.", you have entered an invalid value.


Jun 10, 2009 at 10:09 AM We are using the 9s12xep100. As of May 6, 2009, it takes ~10 minutes to program a single device using prog12z. Has this issue been addressed/resolved?
Thankyou
Jun 10, 2009 at 9:33 PM Hi Debbie,
We can create a flash programming algorithm that utilizes the PLL in the XE100 microcontroller to increase the speed of flash programming. If you are interested, fill in this request form: http://www.pemicro.com/SRS/create_SR_flashAlgRequest.cfm
Please provide the speed of your crystal oscillator or external clock.
Best Regards,
Johnny
P&E Technical Support