MM9Z1J638 erase EEPROM problem

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

MM9Z1J638 erase EEPROM problem

Jump to solution
5,124 Views
romanarxxy
Contributor II

Greetings Dear Experts, I'm trying to debug MM9Z1J638 MCU with a selfmade programmer, i looked in Datasheet and  succesfully read Device ID EEprom and PFlash but when i try to ERASE eeprom it do nothing I'm using comands

0x12 (cmd)

0x10 (adr High)

0x0000 (adr Med+Low)

also i tried with 0x1210(cmd+adrHigh) 0x0000 and many other options... as i see before doing this i need to clear CCIF register but i cant find any information in datasheet how i can do it with bdm commands, what commands shall i use to clear FSTAT register and where it is located, also i wonder what is the address of FCLKDIV register

And also i wonder shall i send comand like 0x09 as a 2 words like 0x0910 0x0000 or i shall do it like 0x09 0x10 0x0000 

I really need some tips in explaination of this command (0x09 0x11 0x12 etc) ((commands that need clearing errors before start))

Thanks in advance!

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
5,065 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

1) There are two ways how to program MCU with self made programmer – either via BDM or using bootloader. Of course, bootloader also requires its load via BDM.

If you use mass erase command then it is suitable immediately unsecure the mcu by rewriting the security byte in the flash. If it is not done then the MCU is secured after next reset.

You can also erase the flash sector by sector.

Bootloader is described here:

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Programmer-for-S12Z-microcontroller/m-p/182...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-MagniV-Serial-Bootloader-Interface/m-p...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Simple-Serial-Bootloader-for-S12Z-AN-draft/...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-Corruption/m-p/955528/highlight/true

 

First of all you should read the data sheet to understand how the programming and erasing memory works.

 

2) If you mean you want to program the data into the EEPROM and FLASH by means your application SW, then it is another story.

In both cases it is necessary to switch off the memory window (or shift to the part which is not EW) because it reads flash and it is not allowed to read the flash while it is E/W.

 

My question is. Does the “self made programmer” means either bootloader or debug interface or your application SW?

 

Best regards,

Ladislav

View solution in original post

3 Replies
5,091 Views
romanarxxy
Contributor II

I chose wrong directory when creating theme i'm sorry, as i understand i shall write FCLKDIV register before operation and erase errors but FSTAT register is 0x80 before start... so what shall i do? and do i need to write directly to FCCOB register or i can use comand just as it presented in datsheet? for example i want to erase entire eeprom to reprog it again, so what exactly i shall do? FCLKDIV is set fclkdiv=80 after sending 0x00 to it, FSTAT= 80 so it means mcu is free and no errors stored, what's next? i just need to send 0x12 and address? but its not work for me, im doing erase comands like this
sending 2 words
0x1210(comand + adr_high)
0x0000(adr_med + adr_low)
what am i missing?
Thanks for reply

0 Kudos
Reply
5,066 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

1) There are two ways how to program MCU with self made programmer – either via BDM or using bootloader. Of course, bootloader also requires its load via BDM.

If you use mass erase command then it is suitable immediately unsecure the mcu by rewriting the security byte in the flash. If it is not done then the MCU is secured after next reset.

You can also erase the flash sector by sector.

Bootloader is described here:

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Programmer-for-S12Z-microcontroller/m-p/182...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-MagniV-Serial-Bootloader-Interface/m-p...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Simple-Serial-Bootloader-for-S12Z-AN-draft/...

https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-Corruption/m-p/955528/highlight/true

 

First of all you should read the data sheet to understand how the programming and erasing memory works.

 

2) If you mean you want to program the data into the EEPROM and FLASH by means your application SW, then it is another story.

In both cases it is necessary to switch off the memory window (or shift to the part which is not EW) because it reads flash and it is not allowed to read the flash while it is E/W.

 

My question is. Does the “self made programmer” means either bootloader or debug interface or your application SW?

 

Best regards,

Ladislav

5,050 Views
romanarxxy
Contributor II

my selfmade is debug interface+selfmade SW for sending commands

 

anywaym i already figured out how to do it with you help, thanks a lot!

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2034317%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EMM9Z1J638%20erase%20EEPROM%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034317%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGreetings%20Dear%20Experts%2C%20I'm%20trying%20to%20debug%20MM9Z1J638%20MCU%20with%20a%20selfmade%20programmer%2C%20i%20looked%20in%20Datasheet%20and%26nbsp%3B%20succesfully%20read%20Device%20ID%20EEprom%20and%20PFlash%20but%20when%20i%20try%20to%20ERASE%20eeprom%20it%20do%20nothing%20I'm%20using%20comands%3C%2FP%3E%3CP%3E0x12%20(cmd)%3C%2FP%3E%3CP%3E0x10%20(adr%20High)%3C%2FP%3E%3CP%3E0x0000%20(adr%20Med%2BLow)%3C%2FP%3E%3CP%3Ealso%20i%20tried%20with%200x1210(cmd%2BadrHigh)%200x0000%20and%20many%20other%20options...%20as%20i%20see%20before%20doing%20this%20i%20need%20to%20clear%20CCIF%20register%20but%20i%20cant%20find%20any%20information%20in%20datasheet%20how%20i%20can%20do%20it%20with%20bdm%20commands%2C%20what%20commands%20shall%20i%20use%20to%20clear%20FSTAT%20register%20and%20where%20it%20is%20located%2C%20also%20i%20wonder%20what%20is%20the%20address%20of%20FCLKDIV%20register%3C%2FP%3E%3CP%3EAnd%20also%20i%20wonder%20shall%20i%20send%20comand%20like%200x09%20as%20a%202%20words%20like%200x0910%200x0000%20or%20i%20shall%20do%20it%20like%200x09%200x10%200x0000%26nbsp%3B%3C%2FP%3E%3CP%3EI%20really%20need%20some%20tips%20in%20explaination%20of%20this%20command%20(0x09%200x11%200x12%20etc)%20((commands%20that%20need%20clearing%20errors%20before%20start))%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2034317%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3ESmall%20Engine%20Driver%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2035055%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MM9Z1J638%20erase%20EEPROM%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2035055%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Emy%20selfmade%20is%20debug%20interface%2Bselfmade%20SW%20for%20sending%20commands%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Eanywaym%20i%20already%20figured%20out%20how%20to%20do%20it%20with%20you%20help%2C%20thanks%20a%20lot!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2034993%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MM9Z1J638%20erase%20EEPROM%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034993%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3E1)%20There%20are%20two%20ways%20how%20to%20program%20MCU%20with%20self%20made%20programmer%20%E2%80%93%20either%20via%20BDM%20or%20using%20bootloader.%20Of%20course%2C%20bootloader%20also%20requires%20its%20load%20via%20BDM.%3C%2FP%3E%0A%3CP%3EIf%20you%20use%20mass%20erase%20command%20then%20it%20is%20suitable%20immediately%20unsecure%20the%20mcu%20by%20rewriting%20the%20security%20byte%20in%20the%20flash.%20If%20it%20is%20not%20done%20then%20the%20MCU%20is%20secured%20after%20next%20reset.%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20erase%20the%20flash%20sector%20by%20sector.%3C%2FP%3E%0A%3CP%3EBootloader%20is%20described%20here%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3E%3CA%20id%3D%22menur1q9%22%20class%3D%22fui-Link%20___1q1shib%20f2hkw1w%20f3rmtva%20f1ewtqcl%20fyind8e%20f1k6fduh%20f1w7gpdv%20fk6fouc%20fjoy568%20figsok6%20f1s184ao%20f1mk8lai%20fnbmjn9%20f1o700av%20f13mvf36%20f1cmlufx%20f9n3di6%20f1ids18y%20f1tx3yz7%20f1deo86v%20f1eh06m1%20f1iescvh%20fhgqx19%20f1olyrje%20f1p93eir%20f1nev41a%20f1h8hb77%20f1lqvz6u%20f10aw75t%20fsle3fq%20f17ae5zn%22%20title%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fs12-magniv-microcontrollers%2Fprogrammer-for-s12z-microcontroller%2Fm-p%2F1828519%23m19723%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FProgrammer-for-S12Z-microcontroller%2Fm-p%2F1828519%23M19723%22%20target%3D%22_blank%22%20aria-label%3D%22Link%20https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FProgrammer-for-S12Z-microcontroller%2Fm-p%2F1828519%23M19723%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FProgrammer-for-S12Z-microcontroller%2Fm-p%2F1828519%23M19723%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FS12Z-MagniV-Serial-Bootloader-Interface%2Fm-p%2F1522147%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FS12Z-MagniV-Serial-Bootloader-Interface%2Fm-p%2F1522147%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FSimple-Serial-Bootloader-for-S12Z-AN-draft%2Fta-p%2F1126452%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FSimple-Serial-Bootloader-for-S12Z-AN-draft%2Fta-p%2F1126452%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-teams%3D%22true%22%3E%3CA%20id%3D%22menur251%22%20class%3D%22fui-Link%20___1q1shib%20f2hkw1w%20f3rmtva%20f1ewtqcl%20fyind8e%20f1k6fduh%20f1w7gpdv%20fk6fouc%20fjoy568%20figsok6%20f1s184ao%20f1mk8lai%20fnbmjn9%20f1o700av%20f13mvf36%20f1cmlufx%20f9n3di6%20f1ids18y%20f1tx3yz7%20f1deo86v%20f1eh06m1%20f1iescvh%20fhgqx19%20f1olyrje%20f1p93eir%20f1nev41a%20f1h8hb77%20f1lqvz6u%20f10aw75t%20fsle3fq%20f17ae5zn%22%20title%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fs12-magniv-microcontrollers%2Fflash-corruption%2Fm-p%2F955528%2Fhighlight%2Ftrue%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FFlash-Corruption%2Fm-p%2F955528%2Fhighlight%2Ftrue%22%20target%3D%22_blank%22%20aria-label%3D%22Link%20https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FFlash-Corruption%2Fm-p%2F955528%2Fhighlight%2Ftrue%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS12-MagniV-Microcontrollers%2FFlash-Corruption%2Fm-p%2F955528%2Fhighlight%2Ftrue%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EFirst%20of%20all%20you%20should%20read%20the%20data%20sheet%20to%20understand%20how%20the%20programming%20and%20erasing%20memory%20works.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E2)%20If%20you%20mean%20you%20want%20to%20program%20the%20data%20into%20the%20EEPROM%20and%20FLASH%20by%20means%20your%20application%20SW%2C%20then%20it%20is%20another%20story.%3C%2FP%3E%0A%3CP%3EIn%20both%20cases%20it%20is%20necessary%20to%20switch%20off%20the%20memory%20window%20(or%20shift%20to%20the%20part%20which%20is%20not%20EW)%20because%20it%20reads%20flash%20and%20it%20is%20not%20allowed%20to%20read%20the%20flash%20while%20it%20is%20E%2FW.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E%3CSTRONG%3EMy%20question%20is.%20Does%20the%20%E2%80%9Cself%20made%20programmer%E2%80%9D%20means%20either%20bootloader%20or%20debug%20interface%20or%20your%20application%20SW%3F%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ELadislav%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2034326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20MM9Z1J638%20erase%20EEPROM%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2034326%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20chose%20wrong%20directory%20when%20creating%20theme%20i'm%20sorry%2C%20as%20i%20understand%20i%20shall%20write%20FCLKDIV%20register%20before%20operation%20and%20erase%20errors%20but%20FSTAT%20register%20is%200x80%20before%20start...%20so%20what%20shall%20i%20do%3F%20and%20do%20i%20need%20to%20write%20directly%20to%20FCCOB%20register%20or%20i%20can%20use%20comand%20just%20as%20it%20presented%20in%20datsheet%3F%20for%20example%20i%20want%20to%20erase%20entire%20eeprom%20to%20reprog%20it%20again%2C%20so%20what%20exactly%20i%20shall%20do%3F%20FCLKDIV%20is%20set%20fclkdiv%3D80%20after%20sending%200x00%20to%20it%2C%20FSTAT%3D%2080%20so%20it%20means%20mcu%20is%20free%20and%20no%20errors%20stored%2C%20what's%20next%3F%20i%20just%20need%20to%20send%200x12%20and%20address%3F%20but%20its%20not%20work%20for%20me%2C%20im%20doing%20erase%20comands%20like%20this%3CBR%20%2F%3Esending%202%20words%3CBR%20%2F%3E0x1210(comand%20%2B%20adr_high)%3CBR%20%2F%3E0x0000(adr_med%20%2B%20adr_low)%3CBR%20%2F%3Ewhat%20am%20i%20missing%3F%3CBR%20%2F%3EThanks%20for%20reply%3C%2FP%3E%3C%2FLINGO-BODY%3E