Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

search inside this forum
search inside all forums
USB Multilink Universal with MKW36Z512 and "module could not be erased"
. Mar 12, 2020 at 04:19 PM (16:19 hours)
Staff: Zahar R.

  • I've got a custom made board with MKW36Z512 MCU. NMI and RESET are pulled high. Power supply is stable (checked with an oscilloscope)

    IDE is MCUXpresso 10.3.1.

    Factory new MCU (not touched by any other debug probe before), trying to upload and debug the most basic GPIO_LED SDK example after editing the pin muxes according to current setup.

    I'm unable to start the debug session, the log is below.

    Command Line :C:\nxp\MCUXpressoIDE_10.3.1_2233\ide\plugins\com.pemicro.debug.gdbjtag.pne.expansion_4.5.3.202002032127\win32\pegdbserver_console -device=NXP_KWx_KW36Z512M4 -startserver -singlesession -serverport=7224 -gdbmiport=6224 -interface=USBMULTILINL
    P&E Interface detected - Flash Version 10.42


    Target has been RESET and is active.
    CMD>CM C:\Users\armi\Downloads\supportFiles_ARM\NXP\KWx\freescale_kw36z512m4_pflash_dflash_eeprom.arp


    ;version 1.02, 12/03/2019, Copyright 2019 P&E Microcomputer Systems, Inc. All rights reserved. [kw36x512k_x_pflash_dflash_eeprom]

    ;device freescale, kw36z512m4, pflash_dflash_eeprom

    ;begin_cs device=$00000000, length=$14000800, ram=$20000000

    Loading programming algorithm ...
    Programming sequency is : erase, blank check, program, and verify {default}
    Command is inactive for this .ARP file.
    VC is not implemented, falling back to VM


    Verify error at address $00000004.
    Byte in module is $11 and should be $25.
    Current content of flash does not match application to be programmed

    Module could not be erased.
    Error Erasing flash of device
    Error occured during Flash programming.

    PEmicro GDB Launch Failure : Error during flash programming. Terminating debug session.

    How come?


    • Hello,

      What version of the PEmicro plugin do you have installed in MCUXpresso? Our latest version is 4.5.3. If you are not at this version, please update and try your test again.

      -Gilbert Y.

  • hi, thank you for the reply. 

    the answer is in my previous message: com.pemicro.debug.gdbjtag.pne.expansion_4.5.3.202002032127

    Kind regards


    • Hi,

      I was able to recreate the issue on our development board in our office. I will begin looking into this issue and let you know when there is more information.

      -Gilbert Y.

    • How is the board being powered? Is the MultiLink providing power to the device or is the device being externally powered? Which RESET line is your debug header connected to? Please ensure that it is not the T_RST line.

      We only seem to have an issue when the device is being powered via the MultiLink FX at 3.3V or 5V, but if the evaluation board is powered via its USB port we do not have an issue. I would need to look deeper into the schematic of the evaluation board. If you based the power circuitry on the KW36 evaluation board, please note that this could be an issue for you.

  • hi,

    the board is powered from external 3.3V source. Yellow LED on the debugger is lit. The power circuit on my board is copied form the FRDM-KW36. I checked the VCC voltage directly on MCU pins. It's standing still at 3.3V

    • Can you confirm for me that the power and ground signals that are passed to the the SWD/JTAG header is the same as the Vdd and ground of the device?

    • If possible, would you be able to provide us the schematics of your board? Someone on our engineering team has seen issues with parts that have OpenSDA chips on development boards preventing us from being able to debug/program the target device.

      You can send us schematics by opening up a support request with us (and mentioning this forum post). Please add my name in the description so that it will be easier for me to find it.

      • hi,

        this is 4 layer PCB with ground and VCC planes, definitely connecting all necessary points together. I checked it with ohmmeter just now.

        I do not have OpenSDA interface. Just straight 10-pin header to the DIO, CLK, RST and GND lines of the MCU. This is sooo confusing. I started to question the most basic things in this project :-) I appreciate your involvement.

        I will go through the project once again, check voltages and if found nothing, I will follow your advice and open the ticket.

        Thank you once again.

      • what is the bottom reason for the software to display "Module could not be erased" message?

        i have sniffed and analyzed the SWD conversation during debug session start or erase command, and can see that the MDM-AP status register always reads either 0x00000032 or 0x0001003A depending whether the CPU is in reset or not, in both cases showing Flash Ready flag is set, Mass Erase Enable is set, and System Security flag is cleared. Why I keep getting the erase error then? What _exactly_ is causing the debug driver to raise the error?

        • The error "Module could not be erased." refers to the Erase Module (EM) command in our device algorithm reporting back an error while attempting to perform the erase. 

          It is difficult to say what exactly causes the error. The fact that your device can perform the previous commands (CM and VM) means that your device is at one point properly connected to the MutliLink and MCUxpreso plugin. Can you confirm that the NMI or RESET pin is not being pulled low at any point during the EM operation?

          • checked with the oscilloscope - NMI is high all the time. 

            RESET however, despite being pulled high by 10k resistor, sometimes goes low. I assume this comes from the debug probe, as there are no other connections to this pin.

            For the first time RESET goes low just after the first READ IDCODE command followed by the response (0x0BC11477) then it goes up and down several times during the SWD conversation.

            Would it be the case that there is a problem with the chip itself? I have 5 boards and all of them face the same issue, and the chips are from the same production batch. I had a lot of problems with soldering the bottom center pads during assembly, had to replace the chips twice, as the pads were almost impossible to solder. Counterfeit chips? Came from legitimate source however...

            • Would you be able to provide us with the schematic of your device?

              • I have created a support ticked, as advised before.

    • Hello,

      I hope you are doing well and are in good health.

      Are you still experiencing issues with your KW36 board? Please let us know if you are unable to currently provide the information requested due to the current state of covid-19 and we will check in again once this situation is over.

      -Gilbert Y.

      • Hi,

        I have switched to the LPC-Link2 board with CMSIS-DAP firmware as the debugger, it uses sector erase instead of mass erase to upload firmware.

        The decision however was not to continue with KW36 MCU on this project, as the chip itself causes technological problems during reflow soldering. I will use KL26 with external BLE radio.

        Although the problem with mass erase has not been solved, I will not investigate it further.

        Thank you for your time and effort.

        Kind regards

  • Hi Artoor,

    I have a couple follow up questions, recommendations:

    Do you rely on a charged battery to provide power to the rest of the board?
    Please go to the Debugger Configuration -> Debugger tab -> and make sure Use SWD protocol is used.
    Please go to the Debugger Configuration -> Debugger tab -> and check the box that states Emergency Kinetis Device Recovery
    Please add -outputdebugfile to Server Parameters text box.
    The next time you run a debug session, a .out log file will be generated in your MCUXpresso installation folder\ide\plugins\com.pemicro.debug.gdbjtag.pne_4.5.3.202002032127\win32 after you run and end a debug session.

    Once you have it, please send it to zahar at pemicro dot com.

    Best Regards,

Add comment

   Want to comment? Please login or create a new PEmicro account.

© 2021 P&E Microcomputer Systems Inc.
Website Terms of Use and Sales Agreement