MC9S12XDP512 Programming Failure

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MC9S12XDP512 Programming Failure

3,731 Views
nicholas_s_schn
Contributor I

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"

0 Kudos
5 Replies

3,496 Views
kef2
Senior Contributor IV

The first thing you should try is creating new project and flashing it. Chances are it will work well.

Did you try unsecuring using debugger script or P&E Unsecure12 utility. Try P&E utility in the first place, debuggers unsecure script may not always work. To use debuggers unsecure script you need at least to make sure right IO_DELAY_CNT is specified in communications dialog (14 for 16MHz crystal clock).

I wonder how do you get this: "Error while writing to FFFE..101FE". Wrong address range anyway, I suspect bug in your code, like missing #pragma CODE_SEG DEFAULT below the vectors table or something like this. If you use forums search you will find exactly the same error appeared several times in the past. Unfortunately no feedback of what happened actually. Someone told it was broken BDM cable, but I doubt it was real cause.

Edward

0 Kudos

3,496 Views
nicholas_s_schn
Contributor I

Thanks for the suggestions.

I created a new project with minimal code. It simply took a counter and iterated with each loop count. I was unable to flash the micro and received the same error information.

I also tried using the Unsecure utility and observed the same behavior.

The code is under configuration management so I know it hasn't changed since it was previously used. The fact that the same code was used successfully in the past loading over 70 micros makes me suspect there is no escaped bug that could be present.

I'm trying to track down information on the mask set of the microcontrollers previously used and compare that to the mask set of the current lot.

In addition, I loaded the same binary onto an Adapt9S12XD evaluation successfully.

0 Kudos

2,983 Views
andrewmeyerbti
Contributor III

Nicholas, did you ever get a resolution?  I am having a similar problem with the same chip.  It seems to program once, and then never again; un-protecting it does not seem to work, as i get FP: The UNPROTECT command is not available for the DFLASH flash module=> Skipped.   

0 Kudos

2,737 Views
kef2
Senior Contributor IV

S12XD family doesn't have DFLASH, only EEPROM! 

0 Kudos

3,496 Views
kef2
Senior Contributor IV
  • I created a new project with minimal code. It simply took a counter and iterated with each loop count. I was unable to flash the micro and received the same error information.

Then something is wrong, either BDM or boards. You say you are able to program some. Could you read PARTIDH/L registers from good and bad boards?

0 Kudos