Kinetis MKM34Z256VLL7 MCU shows "The flash loader reported an error" when programming

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

Kinetis MKM34Z256VLL7 MCU shows "The flash loader reported an error" when programming

1,969 Views
nitish
Contributor I

Hi,

I was trying to program the MKM34Z256VLL7 MCU using a IAR for ARM 7.5 & PE micro debugger with a simple blinking & polling based switch code, when it reset(see pic 1). After closing the debug session & trying to reprogram the controller, I received the error "The flash loader reported an error" (see pic 2) followed by (see pic 3). Very new to this platform, any help would be greatly appreciated. We had programmed this board multiple times earlier without any issues.

1.png      2.png   3.png

Edit: tried to recover using Kinetis Recovery Tool, had no effect.

Labels (1)
3 Replies

1,624 Views
biswanath_bhowmick
NXP Employee
NXP Employee

Hi Nitish,

Your IAR program snapshot shows you've jumped into 0x408 which is Kinetis MCU flash protection area. You can download and refer KM34Z256 RM document from nxp.com and refer the section describing below -

pastedImage_1.png

Further - 

pastedImage_2.png

So, you might have accidentally cleared few bits of these register bits, thereby causing no more flash program/download possible. If this is really the case, you must program correctly to program the target, I can recommend below things -

1. Refer download the newest SDK code from this link Welcome | MCUXpresso SDK Builder for a NXP platform code and make sure to have a memory section separated for the flash configuration fields. For example SDK_2.2_TWR-KM34Z75M\boards\twrkm34z75m\driver_examples\gpio\led_output used a MKM34Z256xxx7_flash.icf linker file, which allocated this section as below -

define symbol m_flash_config_start     = 0x00000400;

..

define region m_flash_config_region = mem:[from m_flash_config_start to m_flash_config_end];

...

place in m_flash_config_region              { section FlashConfig };

In the gpio_led_output project workspace, it included a startup_MKM34Z7.s that has below section -

SECTION FlashConfig:CODE
__FlashConfig
DCD 0xFFFFFFFF
DCD 0xFFFFFFFF
DCD 0xFFFFFFFF
DCD 0xFFFFFFFE
__FlashConfig_End

that correctly initialized the Kinetis flash configuration area to a default good state. You can reuse the same in your program and built. You can check an area appeared called FlashConfig appeared into your generated .map file to make sure the of this section being created.

Please let us know if you have any further queries.

Hope this helps.

Best regards,

Biswanath

1,624 Views
nitish
Contributor I

Thanks Biswanath, this solves the issue.

0 Kudos

1,624 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Nitish Pattanayak,

    I don't know what the code you are using.

    But I highly recommend you use our newest SDK project for KM34, it also have the IAR project.

   Please download the newest SDK code from this link:

Welcome | MCUXpresso SDK Builder 

  Then select the chip as MKM34Z256VLL7 , generate the code and download it.

   You can test this code: SDK_2.2_TWR-KM34Z75M\boards\twrkm34z75m\driver_examples\gpio\led_output

   It's also the led blinky code.

   Besides, your IAR is really very old, I am afraid your IAR can't support the KM34, so please download the new IAR 8.X, our sdk code also based on the IAR 8.x.

You can download the new IAR from the IAR website.

  Then try it again, I have tested the IAR8.x km34 project, it works OK, it doesn't have your problem.

  Wish it helps you!

  If you still have question about it, please kindly let me know.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------