Nicholas Schneck

MC9S12XDP512 Programming Failure

Discussion created by Nicholas Schneck on Aug 6, 2019
Latest reply on Aug 12, 2019 by Edward Karpicz

Greetings,

I'm having trouble programming several MC9S12XDP512 devices. I've seen a couple older posts with related information in the command window of the Hiwave debugger but haven't seen an actual root cause or resolution.

 

Backstory:

My team designed several Circuit Card Assemblies (CCAs) which used MC9S12XDP512 microcontrollers. Software was developed using CodeWarrior IDE version 5.9.0, Build 2836. Programming is performed is a P&E Micro USB Multilink. Many years later, we decided to have additional CCAs build (by a different company) to build additional systems and have spare CCAs in stock.

 

The new CCAs are being tested and attempts to load the same software using the same tools is failing. I ran the Unsecure command file, which was successful, but the subsequent attempt to program failed. The debugger command log for this sequence is included at the end of this post. The team performed a remove and replace of the part, but the CCA exhibited the same behavior. The PC being used to load software has remained unconnected to any network, so the chance for an OS update or patch being installed is non existent. The fact that I have success in loading the software on some of these boards but not others makes me think the root cause is electrical but the troubleshooting has been futile. Could a missing input/ground or trace error cause an issue like this?

 

Command Log:

Loading Target ...
IO registers loaded for MC9S12XDP512 from C:\Program Files\Freescale\CodeWarrior for S12(X) V5.0\prog\REG\MCU03F0.REG
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_startup.cmd

!// At startup the commands written below will be executed
Target Ready
done .\cmd\P&E_Multilink_CyclonePro_startup.cmd

Startup command file correctly executed.
executing .\cmd\P&E_Multilink_CyclonePro_preload.cmd

!// Before load the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_preload.cmd

Preload command file correctly executed.
FP: FLASH parameters loaded for MC9S12XDP512_V10(NVMIF2 rev 2,2,2,1,1,1,1) from C:\Program Files\Freescale\CodeWarrior for S12(X) V5.0\prog\FPP\mcu03F0.fpp
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_reset.cmd

!// After reset the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_reset.cmd

Reset command file correctly executed.

MCU clock speed: 8017000 Hz
Block Module Name Address Range Status
0 FLASH_4000 4000 - 7FFF Blank - Unselected
1 FLASH_C000 C000 - FFFF Programmed - Unselected
2 ALL_PPAGES E08000 -FFBFFF Programmed - Unselected
3 EEPROM_C00 C00 - FFF Blank - Unselected
4 ALL_EPAGES FC0800 -FF0BFF Blank - Unselected
5 EEPROM_800 800 - BFF Blank - Unselected
6 FLASH_8000 8000 - BFFF Blank - Unselected

FP: The UNPROTECT command is not available for the FLASH_4000 flash module => Skipped.

FP: The UNPROTECT command is not available for the FLASH_C000 flash module => Skipped.

FP: The UNPROTECT command is not available for the ALL_PPAGES flash module => Skipped.

FP: The UNPROTECT command is not available for the EEPROM_C00 flash module => Skipped.

FP: The UNPROTECT command is not available for the ALL_EPAGES flash module => Skipped.

FP: The UNPROTECT command is not available for the EEPROM_800 flash module => Skipped.

FP: The UNPROTECT command is not available for the FLASH_8000 flash module => Skipped.
executing .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

Vppon command file correctly executed.

FP: Operation failed on FLASH_4000 flash module.

FP: Operation failed on FLASH_C000 flash module.

FP: Operation failed on ALL_PPAGES flash module.
<Timeout>
FP: Operation failed on EEPROM_C00 flash module.
<Timeout>
FP: Operation failed on ALL_EPAGES flash module.
<Timeout>
FP: Operation failed on EEPROM_800 flash module.
<Timeout>
FP: Operation failed on FLASH_8000 flash module.
executing .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

Vppoff command file correctly executed.
FP: No Module selected!
Selecting all modules.
FP: Arm FLASH for loading.
executing .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

Vppon command file correctly executed.
<Timeout><Timeout>executing .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

Vppoff command file correctly executed.
FP: FLASH disarmed.
FP: Unselecting all modules.
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_reset.cmd

!// After reset the commands written below will be executed
ILLEGAL_BP
done .\cmd\P&E_Multilink_CyclonePro_reset.cmd

Reset command file correctly executed.
executing .\cmd\P&E_Multilink_CyclonePro_postload.cmd

!// After load the commands written below will be executed
RESET
done .\cmd\P&E_Multilink_CyclonePro_postload.cmd

Postload command file correctly executed.
executing .\cmd\P&E_Multilink_CyclonePro_erase_unsecure_hcs12.cmd

!// ver 1.1 (7/7/04)
!// HCS12X Core erasing + unsecuring command file:
!// These commands mass erase the chip then program the security byte to 0xFE (unsecured state).
!
!// Evaluate the clock divider to set in ECLKDIV/FCLKDIV registers:
!
!DEFINEVALUEDLG "Information required to unsecure the device" "CLKDIV" 0x49 "To unsecure the device, the command script needs \nthe correct value for ECLKDIV/FCLKDIV onchip\nregisters.\nIf the bus frequency is less than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \"bus frequency (kHz) / 175\"\n\nIf the bus frequency is higher than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \" bus frequency (kHz) / 1400 + 64\"\n(+64 (0x40) is to set PRDIV8 flag)\n\nDatasheet proposed values:\n\nbus frequency\t\tE/FCLKDIV value (decimal)\n\n 16 \tMHz\t\t73\n 8 \tMHz\t\t39\n 4 \tMHz\t\t19\n 2 \tMHz\t\t9\n 1 \tMHz\t\t4\n"
!
!// An average programming clock of 175 kHz is chosen.
!
!// If the oscillator frequency is less than 10 MHz, the value to store
!// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 175 ".
!
!// If the oscillator frequency is higher than 10 MHz, the value to store
!// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 1400 + 0x40 (to set PRDIV8 flag)".
!
!// Datasheet proposed values:
!//
!// oscillator frequency ECLKDIV/FCLKDIV value (hexadecimal)
!//
!// 16 MHz $49
!// 8 MHz $27
!// 4 MHz $13
!// 2 MHz $9
!// 1 MHz $4
!
!
!FLASH RELEASE // do not interact with regular flash programming monitor
!
!//mass erase flash
!reset
!wb 0x03c 0x00 //disable cop
!wait 20
WAITING
END WAITING
!wb 0x100 CLKDIV // set FCLKDIV clock divider
!wb 0x104 0xFF // FPROT all protection disabled
!wb 0x105 0x30 // clear PVIOL and ACCERR in FSTAT register
!wb 0x102 0x00 // clear the WRALL bit in FTSTMOD
!wb 0x105 0x02
!wb 0x102 0x10 // set the WRALL bit in FTSTMOD to affect all blocks
!ww 0x108 0xFFFE
!ww 0x10A 0xFFFF
!wb 0x106 0x41 // write MASS ERASE command in FCMD register
!wb 0x105 0x80 // clear CBEIF in FSTAT register to execute the command
!wait 20 // wait for command to complete
WAITING
END WAITING
!
!//mass erase eeprom
!wb 0x110 CLKDIV // set ECLKDV clock divider
!wb 0x114 0xFF // EPROT all protection disabled
!wb 0x115 0x30 // clear PVIOL and ACCERR in ESTAT register
!wb 0x112 0x00 // clear the WRALL bit in FTSTMOD
!wb 0x115 0x02
!ww 0x118 0x0C00 // write to EADDR eeprom address register
!ww 0x11A 0x0000 // write to EDATA eeprom data register
!wb 0x116 0x41 // write MASS ERASE command in ECMD register
!wb 0x115 0x80 // clear CBEIF in ESTAT register to execute the command
!wait 20 // wait for command to complete
WAITING
END WAITING
!
!//reprogram Security byte to Unsecure state
!reset
!wb 0x03c 0x00 //disable cop
!wait 20
WAITING
END WAITING
!wb 0x102 0x00 // clear the WRALL bit in FTSTMOD
!wb 0x105 0x02
!wb 0x100 CLKDIV // set FCLKDIV clock divider
!wb 0x100 CLKDIV // set FCLKDIV clock divider
!wb 0x104 0xFF // FPROT all protection disabled
!wb 0x105 0x30 // clear PVIOL and ACCERR in FSTAT register
!wb 0x102 0x00 // clear the WRALL bit in FTSTMOD
!wb 0x105 0x02
!ww 0xFF0E 0xFFFE // write security byte to "Unsecured" state
!wb 0x106 0x20 // write MEMORY PROGRAM command in FCMD register
!wb 0x105 0x80 // clear CBEIF in FSTAT register to execute the command
!wait 20 // wait for command to complete
WAITING
END WAITING
!
!reset
!
!undef CLKDIV // undefine variable
!
done .\cmd\P&E_Multilink_CyclonePro_erase_unsecure_hcs12.cmd

Unsecure command file correctly executed.
IO registers loaded for MC9S12XDP512 from C:\Program Files\Freescale\CodeWarrior for S12(X) V5.0\prog\REG\MCU03F0.REG
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_startup.cmd

!// At startup the commands written below will be executed
Target Ready
done .\cmd\P&E_Multilink_CyclonePro_startup.cmd

Startup command file correctly executed.
FP: FLASH parameters loaded for MC9S12XDP512_V10(NVMIF2 rev 2,2,2,1,1,1,1) from C:\Program Files\Freescale\CodeWarrior for S12(X) V5.0\prog\FPP\mcu03F0.fpp
executing .\cmd\P&E_Multilink_CyclonePro_preload.cmd

!// Before load the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_preload.cmd

Preload command file correctly executed.
FP: FLASH parameters loaded for MC9S12XDP512_V10(NVMIF2 rev 2,2,2,1,1,1,1) from C:\Program Files\Freescale\CodeWarrior for S12(X) V5.0\prog\FPP\mcu03F0.fpp
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_reset.cmd

!// After reset the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_reset.cmd

Reset command file correctly executed.

MCU clock speed: 8016000 Hz
Block Module Name Address Range Status
0 FLASH_4000 4000 - 7FFF Blank - Unselected
1 FLASH_C000 C000 - FFFF Programmed - Unselected
2 ALL_PPAGES E08000 -FFBFFF Programmed - Unselected
3 EEPROM_C00 C00 - FFF Blank - Unselected
4 ALL_EPAGES FC0800 -FF0BFF Blank - Unselected
5 EEPROM_800 800 - BFF Blank - Unselected
6 FLASH_8000 8000 - BFFF Blank - Unselected

FP: The UNPROTECT command is not available for the FLASH_4000 flash module => Skipped.

FP: The UNPROTECT command is not available for the FLASH_C000 flash module => Skipped.

FP: The UNPROTECT command is not available for the ALL_PPAGES flash module => Skipped.

FP: The UNPROTECT command is not available for the EEPROM_C00 flash module => Skipped.

FP: The UNPROTECT command is not available for the ALL_EPAGES flash module => Skipped.

FP: The UNPROTECT command is not available for the EEPROM_800 flash module => Skipped.

FP: The UNPROTECT command is not available for the FLASH_8000 flash module => Skipped.
executing .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

Vppon command file correctly executed.

FP: Call of a command not implemented!
Please modify "flags" in FLASH_4000 module INFO applet.
<Timeout>
FP: Operation failed on FLASH_C000 flash module.
<Timeout>
FP: Operation failed on ALL_PPAGES flash module.
<Timeout>
FP: Operation failed on EEPROM_C00 flash module.
<Timeout>
FP: Operation failed on ALL_EPAGES flash module.
<Timeout>
FP: Operation failed on EEPROM_800 flash module.
<Timeout>
FP: Operation failed on FLASH_8000 flash module.
executing .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

Vppoff command file correctly executed.
FP: Arm FLASH for loading.
executing .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

!// Before programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppon.cmd

Vppon command file correctly executed.
<Timeout><Timeout>executing .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

!// After programming the flash, the commands written below will be executed
done .\cmd\P&E_Multilink_CyclonePro_vppoff.cmd

Vppoff command file correctly executed.
FP: FLASH disarmed.
USB HCS08/HCS12 MULTILINK detected - Flash Version 5.84
executing .\cmd\P&E_Multilink_CyclonePro_reset.cmd

!// After reset the commands written below will be executed
ILLEGAL_BP
done .\cmd\P&E_Multilink_CyclonePro_reset.cmd

Reset command file correctly executed.
executing .\cmd\P&E_Multilink_CyclonePro_postload.cmd

!// After load the commands written below will be executed
RESET
done .\cmd\P&E_Multilink_CyclonePro_postload.cmd

Postload command file correctly executed.
Error: Loading failed!

 

 

Upon Failure, a popup window appears with message: "Error while writing to FFFE..101FE"

Outcomes