Can't download code to the MCU (MCF51JM)

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

Can't download code to the MCU (MCF51JM)

Jump to solution
3,732 Views
sebasira
Senior Contributor I

Hello Everydoy!

I've got a DEMO JM Board wich I was using withou problem till just a few seconds ago. Now I can't download the code to the MCU. The MCU is MCF51JM128 (red daugther card), and I've got no other harware.

I was testing the MSCAN module, writing some code, then downloading it... the I did a few changes to the code and when I went to download it, some error windows appears and this is what they say:

 

WINDOW TITLE: NVM Programming

MESSAGE: The operation has been canceled

 

 

WINDOW TITLE: Elf Loader

MESSAGE: Error while writing to 0..200

               Information: No memory at this address

 

WINDOW TITLE: Hi-Wave

MESSAGE: Failed to load <project path>

 

 

And in the  command window this is what I get:

 

Loading Target ...
IO registers loaded for MCF51JM128 from C:\Archivos de programa\Freescale\CodeWarrior for Microcontrollers V6.1\prog\REG\MCU7003.REG
USB-ML-12 detected - Flash Version 5.74
Frequency change to ~8693077hz.
Frequency change to ~23906250hz.
executing .\cmd\CFV1_BDM_P&E_Multilink_CyclonePro_startup.cmd

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


Startup command file correctly executed.
executing CFV1_BDM_P&E_Multilink_CyclonePro.hwc

done CFV1_BDM_P&E_Multilink_CyclonePro.hwc

executing .\cmd\CFV1_BDM_P&E_Multilink_CyclonePro_preload.cmd

!// Before load the commands written below will be executed
Warning - Exception Occured. (PE.34)
Exception Message :
No Link To Target
done .\cmd\CFV1_BDM_P&E_Multilink_CyclonePro_preload.cmd

Preload command file correctly executed.
Warning - Exception Occured. (PE.438)
Exception Message :

Device trimming not successful.
Error: No connection read byte memory access.
FP: No valid FPP file loaded!

executing .\cmd\CFV1_BDM_P&E_Multilink_CyclonePro_postload.cmd

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

Postload command file correctly executed.

 

Labels (1)
0 Kudos
Reply
1 Solution
1,610 Views
kef
Specialist I

You are right, UNSECURE CF won't work with V1 Coldfires. I thought P&E have already separate download for V1 unsecure. I have DEMOQE kit, and it includes CF V1 Unsecure utility. I believe this utility also should work with JM. So please try downloading DEMOQE Toolkit. Hope this url should list it:

 

http://www.pemicro.com/support/download_processor.cfm?family=14

View solution in original post

0 Kudos
Reply
8 Replies
1,610 Views
kef
Specialist I

Did you try to unsecure your chip? P&E unsecure tool may help.

Erased NVOPT byte (SEC bits = 11) at 0x40F means secured part. While flashing new codes, if reset occurs after mass erase but before writing NVOPT back to unsecured state, then part will be secured.

 

0 Kudos
Reply
1,610 Views
sebasira
Senior Contributor I

Hi! Thanks for your reply... I was thinking about doing that (unsecure) but I don't know how to do it for the MCF51JM... In Hi-Wave there's not that option (or at least I couldn't find it)... I'm working with Codewarrior v6.1

 

And where can I download the P&E Unsecure tool?... I couldn't find it neither.

 

Thanks!!!

0 Kudos
Reply
1,610 Views
sebasira
Senior Contributor I

I've download the UNSECURE CF application from here

 

But I guess it's only for the MCF5213, and mine is MCF51JM... When I press the JTAG Unsecure button, I get a message that says:

Device not found. Please make sure that JTAGEN=1 and Retry

 

 

And above, where it says PORT, and I press Refresh List, nothing happens. (As if it couldn't find the board)... But the strange thing is that in Hi-Wave when I enter in CONNECTION, and press the Refresh List button, it detects the board...

 

0 Kudos
Reply
1,611 Views
kef
Specialist I

You are right, UNSECURE CF won't work with V1 Coldfires. I thought P&E have already separate download for V1 unsecure. I have DEMOQE kit, and it includes CF V1 Unsecure utility. I believe this utility also should work with JM. So please try downloading DEMOQE Toolkit. Hope this url should list it:

 

http://www.pemicro.com/support/download_processor.cfm?family=14

0 Kudos
Reply
1,610 Views
sebasira
Senior Contributor I

Thanks Kef!

 

You were right, the Unsecure CF V1 application was on DEMOQE toolkit. I ran it now I can load the code again!

Thank you very much!

 

Any idea why did that happend? Why did I need to unsecure the device?

0 Kudos
Reply
1,610 Views
sebasira
Senior Contributor I

Noooooooo!!!!

 

I think maybe the debugger/programmer module on the DEMO board it's dead... After last reply, when I succesfully unsecure the JM and manage to re-load the code, I try to program it again and the same thing as before happened... I thought it may need to be unsecure again, so I ran Usecure CF V1 application, it said:

 

Interface Cable Detected.

Device Unsecure.

 

 

But then I pressed the reset button on the board and my program (the one inside the MCU, the one that should be erased by unsecuring) was running!!!!! So it didn't unsecure it at all...

 

Then I try connecting the BDM interface to other project of mine and couldn't program it neither (till last week I could)

 

So maybe it's broken... any ideas on what to look for on the boad? everything seems right at simple view...

 

Thanks!

0 Kudos
Reply
1,610 Views
kef
Specialist I

Part could get secured for two reasons. 1) Either your code specifies NVOPT value with security bits set to secured state, or 2) for some reasons reset happens after mass erase, but before reprogramming security bits in NVOPT to unsecured state. Mass erase sets all flash bits, also security bits to all ones. And security bits both set (11) mean secured state.

To my knowledge, after mass erase and code download, true time debugger tries to reprogram security bits to unsecured state (10). I guess this security bits reprogramming is done only in case your code doesn't specify NVOPT value (byte at 0x40F).

 

So you should make sure your code doesn't specify value for byte at 0x40F(NVOPT), or this value should have least signifiand bits set to 10 for debugging. Probably True Time Simulator could be used to check if your code specifies NVOPT or not. But I'm not sure about detail instructions how to, I must try it later.

 

I'm not sure why 2nd unsecure attempt failed. BDM pod shouldnt get broken due software. To check it is still alive I would check /RESET and BKGD pins. As I remember (and I could be wrong), JM parts have reset pin always enabled? If so, then when connecting, BKGD and /RESET pins first both must be pulled high. Then debugger should pull BKGD low, then pulse pulling /RESET pin low, then release BKGD. After that you should see some communications on BKGD pin.

 

 

0 Kudos
Reply
1,610 Views
kef
Specialist I

Sorry for misleading message. I was sure UNsecured state is SEC = 10, like in S12/S12X. On CF V1 it is reversed, SEC = 10 is secured and all other bit combinations - unsecured. So mass erase followed by reset won't make part secured. The only likely way to get secured part when you don't expect it - NVOPT location should be overwritten with something. Didn't you modify *.lcf file so that code starts below 0x410?

 

 

I tried securing my DEMOQE board adding this line to the code:

 

char  nvval @ NVOPT = 2;

 

But CodeWarrior 6.2 detects when part is secured and dialog box popups asking permission to unsecure: "Device is secure. Erase to unsecure?". Automatic CW unsecure seems to working well.

 

0 Kudos
Reply