Author Topic: My experience on Upgrading uTasker for the KE15Z  (Read 143 times)

Offline tdrobnak

  • Newbie
  • *
  • Posts: 20
    • View Profile
My experience on Upgrading uTasker for the KE15Z
« on: November 21, 2019, 10:40:19 PM »
Recently, I found that an issue with a task not being awakened after an I2C read call (see http://www.utasker.com/forum/index.php?topic=2047.0).  Since this issue was fixed since the build I started using for my project with uTasker, I thought it would be a good idea to use a later build that incorporated the changes I had found.  Created the following steps to upgrade my project.

Steps to Update
   1. Obtain the latest stable uTasker operating system.
   2. Unzip to a directory uTasker_latestStableBuild
   3. Create a MCUXpressoWorkspace directory
   4. Follow the uTaser instructions for creating the MCUXpresso integration of the workspace and project, but copy then import the present .cproject, .project, and .settings directory of the previous uTasker project.
   5. Copy all the .launch configurations and Revision History to the new project.
   6. Use WinMerge to find the differences.  Copy what is appropriate to recreate the project, the project directory located in the Applications directory.
   7. Clean and build the project.

I did this upgrade with uTasker_1.4.12.2019.11.15_11.40.37
After going through the "Steps to Update", on first build found that file CO_driver.h line 382, in structure definition CO_CANmodule_t had and unknown definition called QUEUE_HANDLE for CAN_interface_ID.  I found in the previous version of the file that I had, QUEUE_HANDLE was not used in CO_driver.h.    To work around this issue, I included file "types.h" since QUEUE_HANDLE is defined in this file:

#include "types.h"

Although, I did set up and build the uTaskerV1.4 project in MCUXpresso without my application code and it compiled without a problem for the FRDM_KE15Z.  I found that keeping the same Application files and importing the MCUXpresso project from the previous uTasker_1.4.12.2019.02.28 build did have one compiler problem.

After that change, the program would build, but when run, LPUART0 data was being ignored for our project.  Found that file kinetis.h did not have PA_2_LPUART0_RX and PA_3_LPUART_TX defined for PORT_MUX_ALT6 which is used in our project:

#define PA_2_LPUART0_RX           PORT_MUX_ALT6
#define PA_3_LPUART0_TX           PORT_MUX_ALT6

Found that kinetis_uart_pins.h is missing configuration of the LPUART0 port for PORT_MUX_ALT6.
Added after _CONFIG_PERIPHERAL(A, 2, (PA_2_LPUART0_TX | UART_PULL_UPS)), added line:

#elif defined KINETIS_KE15
            _CONFIG_PERIPHERAL(A, 3, (PA_3_LPUART0_TX | UART_PULL_UPS)); // LPUART0_TX on PA3 (alt. function 6)

Added after _CONFIG_PERIPHERAL(A, 1, (PA_1_LPUART0_RX | UART_PULL_UPS)), added line:

#elif defined KINETIS_KE15
            _CONFIG_PERIPHERAL(A, 2, (PA_2_LPUART0_RX | UART_PULL_UPS)); // LPUART0_RX on PA2 (alt. function 6)

I had added these definitions (see attachment files) on the previous version of uTasker and WinMerge helped identify some corrections I made to those uTasker driver level files.  The upgrade process was easy and went better than expected.  My conclusion is that uTasker is designed in a very modular which simplifies the process of upgrading your application code.

Tom

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3000
    • View Profile
    • uTasker
Re: My experience on Upgrading uTasker for the KE15Z
« Reply #1 on: November 22, 2019, 01:43:04 AM »
Hi Tom

1. I think your problem with CO_driver.h is that you used an older MCUXpresso project which doesn't exclude the file CO_OD.c. CO_OD.c is a file that is generated by CANopen tools and included when needed (when CAN and CANopen are enabled) via a different C file that supplies the headers to it.
If you exclude this file in the Eclipse tool chain (which will add all found C-files to the project by default if not done) it will also solve the issue.

2. The KE15 has only been set up for LPUART1 (for its evaluation board) so I suspect that you added these changes previously and they are missing when you update to the latest version.

To cover all LPUART0 pin-out possibilities for the KE15 I have just added:
        #define PB_1_LPUART0_TX          PORT_MUX_ALT2
        #define PA_3_LPUART0_TX          PORT_MUX_ALT6
        #define PA_10_LPUART0_TX         PORT_MUX_ALT3
        #define PB_0_LPUART0_RX          PORT_MUX_ALT2
        #define PA_2_LPUART0_RX          PORT_MUX_ALT6
        #define PA_11_LPUART0_RX         PORT_MUX_ALT3

and (for LPUART0_TX config)
            #if defined LPUART0_ON_B
            _CONFIG_PERIPHERAL(B, 1, (PB_1_LPUART0_TX | UART_PULL_UPS)); // LPUART0_TX on PB1 (alt. function 2)
            #elif defined LPUART0_ON_A_HIGH
            _CONFIG_PERIPHERAL(A, 10, (PA_10_LPUART0_TX | UART_PULL_UPS)); // LPUART0_TX on PA10 (alt. function 3)
            #else
            _CONFIG_PERIPHERAL(A, 3, (PA_3_LPUART0_TX | UART_PULL_UPS)); // LPUART0_TX on PA3 (alt. function 6)
            #endif

and (for LPUART0_RX config)
            #if defined LPUART0_ON_B
            _CONFIG_PERIPHERAL(B, 0, (PB_0_LPUART0_RX | UART_PULL_UPS)); // LPUART0_RX on PB0 (alt. function 2)
            #elif defined LPUART0_ON_A_HIGH
            _CONFIG_PERIPHERAL(A, 11, (PA_11_LPUART0_RX | UART_PULL_UPS)); // LPUART0_RX on PA11 (alt. function 3)
            #else
            _CONFIG_PERIPHERAL(A, 2, (PA_2_LPUART0_RX | UART_PULL_UPS)); // LPUART0_RX on PA2 (alt. function 6)
            #endif


This means that the three options can be selected (from app_hw_kinetis.h) but it defaults to the one you use. This means that if you pull the version again you will have the configuration suitable for your HW.

As you know it is easy to add new pin configurations and, since there are a large number of possibilities for all possible part types the list is probably never 100% complete. In such a case simply add the new pin config as you did and send me the file - then i can ensure that any such setups are specifically added to the repository so that they are there for all future pulls.

If you haven't seen the video showing how to work with your own project embedded in the uTasker framework you can see it at: https://www.youtube.com/watch?v=_7Rxdr0NKWE&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=23
In the case of Eclipse projects your setup (in the root) can be copied to the MCUXpresso\Project_Settings director in your own application folder before cloning the framework (since it will be overwritten). Afterwards copy it back to the root. This is a minor complication with the Eclipse project method but not a big deal.

Regards

Mark

P.S. Before I check in the new LPUART muxes I'll make sure also LPUART1 and LPUART2 Rx/TX set is included for the KE15

Offline tdrobnak

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: My experience on Upgrading uTasker for the KE15Z
« Reply #2 on: November 22, 2019, 10:47:19 PM »
Thank you for the update, Mark.  I just pulled them into my latest uTasker project, built the executable, and FreeMASTER on the serial port is working well with your new changes to the LPUART0 ALT 6 configuration.

Regards,

Tom

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3000
    • View Profile
    • uTasker
Re: My experience on Upgrading uTasker for the KE15Z
« Reply #3 on: November 22, 2019, 11:49:42 PM »
Tom

Great - thanks for the feedback!

Regards

Mark