This page is for you! If you’d like more information about something I’ve posted about, or if there is a topic you think I should post about, please leave a comment and I’ll get right to it (as fast as my schedule permits it)!

I have started to list things in my bucket list (still ongoing).

For feature requests or bug reports on the McuOnEclipse project end Processor Expert components, you should use the GitHub issue tracking system:


733 thoughts on “Requests

  1. Erich,
    I recently discovered a bug in some PEx-generated code for USB. The bug is brought in by invoking your USB component but I believe the problem lies in the Freescale USB Stack V4.1.1 when run on a K40 processor.

    PEx generates two files: wdt_kinetis.c and wdt_kinetis.h, that implement Watchdog_Reset(). The instruction in that subroutine: (void)(WDOG_REFRESH = 0xA602, WDOG_REFRESH = 0xB480); can cause a reset if an interrupt occurs between the two writes to WDOG_REFRESH. This is exactly what you were talking about when you wrote about Critical Sections.

    Watchdog_Reset() is called from usb_dci_kinetis.c, which also appears to be a Freescale USB Stack file.

    Since this code comes from a Freescale driver that I cannot modify and the offending code is re-generated every time I run Processor Expert, what can I do to fix it?



    • Hi Greg,
      I don’t think that case is a problem, because during the call to Watchdog_Reset() the interrupts are already disabled. Watchdog_Reset() is called from the delay loop in USB_DCI_Assert_Resume() which gets called from USB_Class_Initiate_Resume() which does a DisableInterrupts-EnableInterrupts around it. So there should be no interrupts in this case. Let me know if I’m missing something?

      And you can affect the code generation. First you can disable code generation for a component (see Second you can directly change the code base used for the code generation, you only need to find out where the component sources are (see In my case the USB stack sources are in C:\ProgramData\Processor Expert\PEXDRV_PE5_3\Drivers\FSL_USB_Stack. So you could directly modify the sources there if you want.

      I hope this helps,


      • Erich,

        Your description of how wdt_kinetis is used is correct, except I still have a stylistic issue with it. For a Watchdog Reset function to be sitting alone as it is with no comments regarding interrupts, what is the guarantee that future modifications to the software won’t call it while interrupts are enabled?
        In my case, that’s exactly what I did. I saw it sitting there just waiting to be called, so I called it. Then I started getting unexpected resets…

        Thanks for pointing me to the source code those routines come from.



      • Hi Greg,
        Yes, I 100% agree with you. The Freescale engineers seems to have lumped toghther things for the USB stack that way, unfortunately. Well, there is a newer (better?) stack available in the Kinetis SDK V2.0, but I have not adopted that one because that legacy 4.1.1 stack works very well for what I need, and I did not had the bandwidth to learn that SDK v2.0 stack. Wrapping yet another EnterCritical()-ExitCritical() in the watchdog function could have a solution, but creating nested critical sections that way is not a a good thing neither. So I’m not sure what I should do, and the same time I don’t want to invest too much time into that stack. As for the watchdog, I have used my own routines outside of that one of the USB stack.


  2. Hello, Erich!
    I have a mini sumo project using the kl46z and four HC-SR04 for detecting enemies.
    I am having troubles with the lack of counters for both the echo pins (the timer units) and the motors.
    My question is if I can use more than TPM0, TPM1 and TPM2. I know they can have multiple channels, but I do not know how to use them



    • Hi Surdu,
      I would not use HC-SR04 for this task: it is simply not reliable and fast enough. You can use multiple timer channels, depending how you do the measurement. If you do the measurement one after each other, used dedicated pins for triggering the measurement and dedicated pins for the input capture signal.


  3. Hi Erich
    I am trying to communicate between FRDM-K64F and JY-MCU V1.06. I read your article about a pull-up resistor on the RX line that has to be pulled up. I am using KDS and processor expert. It wont allow me to enable the pull-up. CodeWarrior does allow. Does the Bluetooth_EGBT component do it?
    Is there an example I can follow.
    Also what is the advantage of using the Shell component?


  4. Hi again
    Your program FRDM-K64F_Demo does communication between FRDM-K64F and JY-MCU V1.06.
    I think the download from GitHub needs to be run with Eclipse Kepler.
    What has to be done to compile it with KDS.


    • I’m using it in several projects with KDS, but probably have not published one of these projects.
      But simply create a new Processor Expert project with KDS, and add the bluetooth component to it and configure it for the UART you are using.


  5. Hi Erich
    I am trying to create a FreeRTOS project that has 3 tasks. If I enable 1 task it works. 2 or more tasks and it does not work. What am I doing wrong.
    I uploaded the project to GitHub under the name FreeRTOS example. (I think it is there)
    As always, your help is greatly appreciated.


    • Hi Eli,
      where did you upload it on GitHub?
      Have you checked your heap size (or checked the application in the debugger). I think your heap size is too small so you run into the ‘out of memory’ FreeRTOS hook.


  6. The project is on GitHub at EliNaiman/FreeRTOS-example
    My code does not allocate any memory.
    Once it is working, this should be an example for beginners like me.


  7. Hi Erich
    In the FreeRTOS-example that is working, I added the following lines in main.c just before going to Run_Applications();

    /* pull up Rx pin (PTC14) for Bluetooth module */

    The system hangs. I think it is causing an interrupt to occur. How do I take care of this.
    I am using the K64F.


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 )

Google+ photo

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

Connecting to %s