Using the Reset Button on the Freedom Board as User Button

Processor Expert is a great tool: it lets me configure all the complexities of that ARM Cortex-M0+ core. But today it has fooled me and I lost several hours of my week-end time :-(. I need a user interface like push button for my project. Yes, the FRDM-KL25Z has touch area, but honestly: that kind of stuff never worked out well for me. It is probably just me having it not properly set up. The touch slider is working as in my earlier simple example, but in my other project with more hardware around it, it is working sometimes, sometimes not. Ahrg! I can blame my ignorance, my lack of understand how to configure it properly, or the extra noise by the hardware around it. Result is: I wasted a lot of time, and I give up :-(.

SW1 on the FRDM-KL25Z Board

Reset button on the FRDM-KL25Z Board

❗ Lesson number 1: if something is working in a small project, it does not mean that it works as well in another context.

Instead loosing more time using the TSS library, I decided to use the Reset button on the Freedom board instead. A nice feature of the KL25Z is to disable the Reset function and to use it as a general purpose I/O pin. I did this already in an earlier project, and it worked. So it should not be a big deal to have it as well in my other project?

❗ Lesson number 2: never make the assumption that if something worked in one project, it works in another.

So I added a BitIO and configured it for PTA20/RESET_b:

BitIO on Reset pin

BitIO on Reset pin

Next, the CPU component rightfully complains about using the Reset Pin twice:

Reset Control in the CPU

Reset Control in the CPU

With disabled Reset Control, Processor Expert is happy:

Disabled Reset Control

Disabled Reset Control

Generating Code, building the application, then downloading it to the board, and then I tried it out: pressing the Reset/SW1 button, and……


Outsch. But I have configured it to *not* reset. What’s wrong?

Ok, probably my fault. Checked the settings again, generated code again, downloaded it again, and ….. RESET!

Ok, going back to my earlier project, and: here it works! Ok, so I have missed a setting?

❗ Lesson number 3: Having written a tutorial on a topic does not mean that I will be successful in that topic the next time. I need to burn my fingers once or twice first.

As comparing Processor Expert settings is not really simple, I decided to compare the generated source code.

💡 Comparing the XML file is not really practical. What works in most cases is to ‘pin’ one component inspector and compare it with the other. But this is only practical for simple components. And I do not think I would have found my issue that way.

And indeed, after I while I have found that my project does not set RESET_PIN_CFG to zero in Cpu.c:



And now this was ringing a bell! And yes, indeed, I missed this other setting here where I need to disable the Reset Pin Function:

Reset Pin Function

Reset Pin Function

❗ Lesson number 4: Read carefully what you have written in the past. Don’t think that you just can browse through it. I had that screenshot in my earlier post, but simply missed it :-(.

Ok, now I probably will remember next time :-).

❓ That setting is buried under Flash Configuration field > Peripheral Settings. Yes, that kind of stuff is in that part of the microcontroller. But very, very easily to miss. Or should I think about ‘Reset functionality’ when I read ‘Flash configuration’? It would be really great if Processor Expert could add a ‘search’ for all fields of a component, especially the CPU component, as it has so many settings.

Ok, I learned my lessons. And maybe there is another one:

❗ Lesson number 5: Even if Processor Expert simplifies a lot of things, the cause of this are these incredible complex microcontroller today. Looks like I still need to read the several thousands of Reference Manual pages, and to read it probably several times? 😦

Now that Reset button is working as a normal user button, so I can continue my week-end project. And I hope I can prevent someone else to fall into the same trap I did.

Happy Reseting 🙂

25 thoughts on “Using the Reset Button on the Freedom Board as User Button

  1. Pingback: Processor Expert Configuration Registers View | MCU on Eclipse

  2. Hi Erich,
    “It would be really great if Processor Expert could add a ‘search’ for all fields of a component, especially the CPU component, as it has so many settings.”

    If you look to the drill down menu of Component Inspctor, you can find menu “Search…” (I wander why Ctrl+F is not working for me now). It searches by the “Item name” field, also accepting wild cards.

    Or did you mean other functionality?



    • Hi Libor,
      It took me about 5 minutes to find what you mention here. Wow, that functionality is *really* burried, I never would have thought that that this functionality would be down that menu. But really interesting that it exists :-). Thanks for the tip, and I guess now I need to publish a tip on it, as I have heard the same thing from many users.


  3. Pingback: Search in Processor Expert Component Properties | MCU on Eclipse

  4. Pingback: Bricking and Recovering FRDM-KL25Z Boards: Reset, SWD Clock and Low Power | MCU on Eclipse

  5. Pingback: Using the FRDM-KL25Z as USB Keyboard | MCU on Eclipse

  6. Pingback: Pin Muxing: Using the NMI Pin as GPIO Pin | MCU on Eclipse

  7. Hello Erich,

    I’ve a doubt about this, altough it is the opposite of this topic.
    I’m using reset pin as RESET, connected to the programmer header. I’ve been working without making initial configurations for the pin, as Processor Expert did. For example:

    PORTA_PCR1 = (uint32_t)((PORTA_PCR1 & (uint32_t)~(uint32_t)(
    )) | (uint32_t)(

    My code works normally. But I have experienced some unexpected resets problably due to the voltage spikes I’ve seen on the feed voltage.

    My doubt is: it is really necessary to configure the reset pin to do so?Or should I let the pin “unconfigured”? PORTA_PCR shows that it is 0x00000000 from reset.

    Have you ever seen this improve resets rejection?

    Many thanks.


    • Hi Frederico,
      I had issues with injection spikes in one of my designs. The problem was that the external pull-up for the reset pin was not strong enough (was originally I think 10 kOhm, changed it to 1 kOhm. Additionally, the C of the RC had to be changed. More important, I was using the internal filter of the reset pin. This was for a KL25Z in a noisy environment. With above, plus enabling the internal reset filter, the system was working very well. Maybe something like this helps you too?


      • Thanks Erich,

        the uC I’m using is a KL05Z, it looks like KL25Z.
        So I will add the configuration for pin to select reset, input filter and pullup resistor.



  8. Hi Erich,
    I just updated from CodeWarrior to KDS3.2.0 and now it seems I can never use the reset pin for anything else but Reset (i.e. it never seems to be disabled). I have checked in the generated cpu.c and it seems the pin should be disabled, but it really isn’t:
    /* NV_FOPT: ??=1,??=1,FAST_INIT=1,LPBOOT1=1,RESET_PIN_CFG=0,NMI_DIS=0,??=1,LPBOOT0=1 */

    Any idea what I am doing wrong? Does this project work for you on KDS?


    • Hi Ralph,
      With RESET_PIN_CFG=0 the reset pin functionality is disabled, so things are correctly setup on your side. KDS does it correctly. Actually it cares now about the second step to update the flash configuration setting (RESET_PIN_CFG=0). I just tried it with KDS v3.2.0 (should be the same with KDS V3.0.0) and it works for me as expected.
      I hope this helps,


      • Hi Erich,

        thanks for the answer. It turns out the problem actually was in the firmware, which I had programmed onto the FRDM-KL25Z board, which would transfer the code, but not set the reset pin correctly. I am now using the PE-micro one and it works fine.



  9. Has Processor Expert changed since the time of this post to remove this flash configuration field settings? I just installed KDS and created a test application for the FRDM-K64F and I am getting an NMI interrupt no matter what I do. I haven’t connected the PTA4 pin to anything. NMI pin is disabled.


    • No, things have not changed to my knowledge. One thing to keep in mind is that this post changes the muxing (routing the push button to the NMI input logic). The NMI itself is non-maskable, so if your application still triggers a NMI interrupt for whatever reason, the NMI interrupt will happen.


      • I understand that, it’s just that the setting is there in the GUI option for Changing LPBOOT and EZPORT_DIS, but not NMI_DIS. The funny thing is, the generated file CPU_Config.h has the bit set to high, which enables NMI. In my last PE installation (KDS) this option was there under Peripheral settings. Now it’s called common settings and NMI is hard corded to always on. I am changing the generated file to test. If it works I will disabled generating code for the CPU.


        • I think it depends on the board or if it is a K series or a KL series. For KL25Z the setting is under Internal peripherals and for K64F it is under common settings.


  10. Pingback: Recovering Cortex-M Microcontroller with a Power Glitch | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.