Cart New Account Login

HomeAbout usProductsSupportForumsBlogCustomer Service

Please accept the use of cookies on our site

At PEmicro we use web browser cookies in order to provide you with an enhanced experience and in order to be able to do things like shopping cart processing and identify you when you login to our website.

Click here to accept

search inside this forum
search inside all forums
Flashed program using USB Multilink works but only if micro is NOT power cycled after Flashing
Indrajit D. Jan 18, 2018 at 10:22 AM (10:22 hours)
Staff: Takao Y.

  • Hello,

    I am trying to use the USB Multilink to program my NXP Kinetis microcontroller S9KEAZ128AVLK. I am using NXP's s32 Design Studio along with the inbuilt GDB PEMicro Interface Debugging config to Flash the application.

    After the flashing process is complete via the SWD port, as long as the Microcontroller remains powered, the program runs and works as expected. But after a power cycle, the program does not seem to be staying in memory OR at least it appears to not stay in memory as the application doesn't run after a power cycle.

    Am I missing some settings in the flash config so as to make the program retain in memory OR is the USB Multilink not capable of programming this microcontroller so that the application retains in flash memory? Please note that I am using the SWD port for programming.

    I would really appreciate if there is any info or pointers that you can share in this matter.

    Best Regards,


  • Greetings,

    Sounds like you are not programming flash but instead programming RAM. Check to make sure your debug and project configurations are set to program the flash.

    If you are programming flash but not seeing your program run out-of-reset, then you may want to check your watchdog settings. Monitor the reset line and see if you are seeing constant toggling of reset. If so, then your watchdog is interrupting your program. Our tools will disable the watchdog to allow for debugging, but it is up to you to configure it correctly for real-world situations.

    Takao Yamada

    • Hello Takao,

      Thanks for the quick response.
      The default SKEAZ128 linker settings for flash programming indicate certain memory areas for flash; flash config and SRAM. Based on my limited knowledge of s32 design studio, when I program the micro using Debug configuration, all these memory areas for flash; flash config and SRAM have bytes written to it as verified in the memory browser. So I am guessing this means that the application is being flashed to internal flash memory?

      With that being said, if I monitor the RESET line on the scope during power up, I see that the RESET line goes from 0 - 5 V and there is no sign of reset toggling after that.

      Is there anything else that I can check?


  • Greetings,

    Maybe check mode entry (MC_ME) module. By default we reset the chip and set the PC at the reset vector for debugging. However you can change the MC_ME to run in a different mode out of reset. In your code, do you ever go into low-power mode, or stop mode, or other mode changes?

    Takao Yamada

    • Good point. But I am not changing any modes within the code. In fact the Microcontroller reference manual says that the default mode out of RESET is RUN. So, in the code I have not even explicitly called for a Mode entry of RUN.

      Should I be doing that?

  • Greetings,

    No need to force the mode. You are correct that by default it should be in RUN or DRUN mode to run your code flash.

    You may want to create a new project in KDS or S32 ARM and try debugging and power cycling the board to see if you are able to run a basic project. Then you can start comparing and contrasting from there.

    If it is hard to determine if the project is running, you may want to insert code into your project that simply toggles an IO or LED that you can monitor to find out where in code it is failing to execute.

    Takao Yamada

    • Hello Takao,

      I have a code in s32 Design Studio that I am able to debug on the micro (e.g. toggle different digital outputs; Read digital input status and communicate over CAN etc).

      But the issue is as soon as I power cycle the board, it stops communicating (toggling output or CAN communication stops).

      I don't know of a way to connect to the board via s32 - multilink without actually re-starting a new debug session - which requires me to re-flash the micro again.). If I could connect to the board, I can at least check to see if the program stays in memory. If it doesn't then there in lies my problem and I will need to dig in that direction. But if it does, then perhaps the vector table is not set right - Although I haven't changed any of the default settings from an example code. The linker settings (flash.ld) or the startup code section is the same in my application.


  • Greetings,

    You can do an attach session. Go to Debug configurations -> Startup tab -> Attach to running session. This should allow you to start a debug session on a running device without resetting it or reprogramming it.

    Takao Yamada

  • Greetings,

    Any update on this?

    Takao Yamada

  • Hello Takao,

    We have resolved the issue.

    The NMI input (PTB4) of the microcontroller is being used as a Comparator input. Based on how the board is laid out, this input stays low after power on reset which causes it to get stuck in a SysTick_Handler.
    By setting the NMIE bit of SIM_SOPT0 register to 0 at the beginning of the code in software; we were able to disable the NMI functionality after power cycle.

    The application is booting fine after this software fix was made.
    Thanks very much for your support.

Add comment

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

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