Runaway program won't let me reprogram chip

cancel
Showing results for 
Search instead for 
Did you mean: 

Runaway program won't let me reprogram chip

2,380 Views
Emac
Contributor III

The preliminaries:

I have 5.7.0 CW IDE for HCS12, processor =  MCS12A256BCPV, P&E Micro USB multilink interface - USB-PE5012998

The symptoms:

I just enabled the software watchdog and was attempting to reprogram the device when low and behold I am stuck in a loop and the programer / debuger is unable to stop the device long enough to get the new program loaded.

 

Is there a trick to get the processor to completely halt under these circumstances?

Is there an optimal USB interface communication setting that would help me out?

Is there a method to reprogram it so some other code can run?

How do you set the watchdog to start latter in the code instead of in the during generated auto initialization?

 

I think thats enough questions for now. 

 

Thanks in advance.

Labels (1)
Tags (1)
0 Kudos
7 Replies

127 Views
Emac
Contributor III

I managed to get the system to stop by somehow writing to the chip options 0x100 onward but now the system is definitely "secured"

 

Everytime I "unsecure" it with the PEMICRO interface it says "unsecured successfully" but when I go to program I get ...

 

   0  EEPROM             400 -   FFF   Blank - Unselected
   1  FLASH_4000        4000 -  7FFF   Blank - Unselected
   2  FLASH_C000        C000 -  FFFF   Programmed - Unselected
   3  ALL_PPAGES      308000 -3FBFFF   Programmed - Unselected

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

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 FLAT8000_P30 flash module => Skipped.

FP: FLASH_C000 flash module is bad or protected.

FP: ALL_PPAGES flash module is bad or protected.

FP: FLASH_C000 flash module is bad or protected.

FP: FLASH_C000 flash module is bad or protected.

 

My current settings are : Operating mode = special single chip
target operation mode = special single chip

 

I think MODA and MODB pins are set to low

 

I tried PEMICRO unsecure_12 command line software but it reports :First I was getting:
Interface Cable Detected
Searching for Interface Speed
ERROR - Communicating with target.
Appropriate interface speed not found.


Then I got:

Interface Speed Determined
Initial Flash Security Register, FSEC = $FE
WHAT? - Device is Already Unsecured.

 

I am at a loss and really regret initiating the software watchdog - I have had no peace since that point.

 

 

0 Kudos

127 Views
kef
Specialist I
Didn't you try to create new project using new project wizard? If it won't work, then probably there's something wrong with your hardware. If it will work, then there's something wrong with project settings, FLASH AEFSKIPERASING command in some *.cmd files, or something. I believe COP reset can't make chip not programmable.
0 Kudos

127 Views
Emac
Contributor III

Yes, I tried a blank load on the chip with the same results.  I also programmed some other boards and they work fine.

 

I am looking for a way to unsecure / blank erase the whole chip so I can get my new program on it.

 

 

 

0 Kudos

127 Views
CrasyCat
Specialist III

Hello

 

I assume you are using a multilink cable for debugging. Am I right?

 

I would recommend you to check P&E Web site.

As far as I remember they have a utility available to unsecure HC12 chips.

 

CrasyCat

0 Kudos

127 Views
Emac
Contributor III

Thanks CrasyCat,

I have tried their program (unsecure12) and it said that it is unsecured but it still fails to program the two higher level memory blocks.  Most likely because they are still accidentally "secured" with some randomn key.

 

I have posted a service request with P&E and we went as far as we could with it without getting anywhere.

 

0 Kudos

127 Views
Emac98
Contributor I

Found the problem to be hardware related.  Chip was getting reset by external watchdog as the debugger disturbed the timing.  disabled the external reset when a PLD detects a debugger is present. 

 

Short answer, was hardware not software.

0 Kudos

127 Views
kef
Specialist I
There should be no problems flashing new code, unless 1) taget chip is secured, or 2) "At connection, the target is running (hot plugging)" option is on. See MultilinkCyclonePro->Communication...->Special setup tab. By default, out of reset COP is disabled. And with above mentioned option off, debugger resets your target into special mode, which means that after connection no single instruction of your code is executed. Flash programming should be fine.
0 Kudos