FreeMaster 3.1.2.4 with S32K3 Controller

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FreeMaster 3.1.2.4 with S32K3 Controller

Jump to solution
3,333 Views
JoDo
Contributor III

Hi,

I am trying to work with the FreeMaster 3.1.2.4 and the S32K344 controller. I have already installed the FreeMaster application and the FreeMaster communication driver 3.0. I also refer to the FMSTRSCIDRVUG.pdf to change the configuration file, but it is not very well described how to use it.
I know that I need to configure a UART port and add the peripheral address as follows:

JoDo_0-1634022102900.png

and add FMSTR_Init() FMSTR_Poll() to the main file. Is there anything else to do to get started?
Are there some examples for the S32K3 controller? I have not found any.

Regards,

JoDo

 

0 Kudos
1 Solution
3,321 Views
iulian_stan
NXP Employee
NXP Employee

Hi @JoDo,

One more ting you need to consider is the communication mode (it is also defined in freemaster_cfg.h)

//! Select interrupt or poll-driven serial communication
#define FMSTR_LONG_INTR         0   // Complete message processing in interrupt
#define FMSTR_SHORT_INTR        0   // Queuing done in interrupt
#define FMSTR_POLL_DRIVEN       1   // No interrupt needed, polling only

I will assume that it is Poll Driven (as in the snippet above) - it is easier to use as it does not require setting up any interrupts. Note: in case of the other two, you would need to install `FMSTR_SerialIsr` as LPUART callback function.

Note that FMSTR_LPUART_BASE, FMSTR_TRANSPORT, FMSTR_SERIAL_DRV only "inform" FreeMASTER Driver what communication will be used. You still need to configure the uart peripheral (clock, pin muxing) in your code.

Regarding FMSTR_Init and FMSTR_Poll functions:
* FMSTR_Init should be called once in your main function after the peripheral configuration
* FMSTR_Poll should be called periodically (either in a loop or a timed interrupt) depending when you want FreeMASTER driver to process the data it receivers over UART. Here is a simple template of how your main function may look like:

int main(void) {
  /* Initialize chip clock */
  CLOCK_Init(...);

  /* Enable all on-chip peripherals */
  MCME_PeriphCtrl(...);

  /* Pin muxing */
  SIUL_Init(...); /* LPUART13_RX */
  SIUL_Init(...); /* LPUART13_TX */

  /* LPUART13 Init */
  LPUART_Init(LPUART13, ...);

  /* Initialize FreeMASTER */
  FMSTR_Init();

  for (;;) {
    /* FreeMASTER poll function */
    FMSTR_Poll();
  }
 
  return 0;
}

View solution in original post

9 Replies
3,064 Views
Ch1
Contributor I

Hello All,

I have installed Freemaster driver and the application. I want to send commands from Freemaster to s32k344 via UART while still having S32 design studio up and running.

May I know what are my next steps?

Regards,

Ch

0 Kudos
3,057 Views
iulian_stan
NXP Employee
NXP Employee

Hi @Ch1,

Are you referring to this FreeMASTER Communication Driver from the download page or S32K3 Update site ?

The first one (picture below) is for older K1 MCU family.
Capture4.PNG

Soon, there will be a separate (K3 specific download link, similar to G2). In the meantime, could you please check if you can find FreeMASTER package for K3 in your product lists.

You can access it from NXP home page:
MY NXP → Software Licensing and Support →  Software accounts → Search Product (search for "S32K3 FreeMASTER").
Capture.PNG

 

Capture1.PNG

 

Capture2.PNG

 

Capture3.PNG

S32K3 FreeMASTER package includes:

  • Release Notes
  • S32 Design Studio update site (contains FreeMASTER SDK/Driver for K3)
  • User Guide

Release Notes include Update Site installation steps and the User Guide describes Driver configuration options.

In case you can not find it, I attached an archive with those files (this a temporary solution and I will post an update in this thread once a download link is available on FreeMASTER home page).

To answer your question - once you have the update site installed in S32 Design Studio you can create a new project or attach FreeMASTER SDK to your existing project (see Release Notes). From that point can follow the same steps I described in my other reply from the thread.

0 Kudos
3,044 Views
Ch1
Contributor I

Thank you, lulian for the explanation. I have already installed the package and it's already present in my S32 Design studio.

My question is how can I include this SDK package in my project? Also, I see in the previous thread that JoDo has some config (header) files included in the project. Where do I find them and how do I include them in my project? 

Are they related to UART comm?

Regards,

Ch1

0 Kudos
3,032 Views
iulian_stan
NXP Employee
NXP Employee

When you attach the SDK, S32DS will automatically include all FreeMASTER source files (this one shows G2 but should work the same way for K3):

Capture.PNG

After the SDK is attached it should automatically open "freemaster_cfg.h" (FreeMASTER configuration header file), in case it does not open - you can find it in freemaster_include folder in your project tree.
By default, it is configured to work in UART mode: 

 

//! Select communication interface (currently only serial is supported)
#define FMSTR_TRANSPORT         FMSTR_SERIAL                    // Use serial transport layer
#define FMSTR_SERIAL_DRV        FMSTR_SERIAL_S32K344_LPUART     // Use serial driver for UART

 

You can add this files manually as well - all source files can be found in C:\NXP\S32DS.3.4\S32DS\software\FreeMASTER_S32K3_v3\src.

0 Kudos
3,008 Views
Ch1
Contributor I

Thank you lulian!! 

 

Regards,

Chandana M

0 Kudos
3,035 Views
JoDo
Contributor III

Hello,

you can do this when you create a new project by selecting the FreeMaster SDK additionally (see picture).

JoDo_0-1637072798924.png

 

But here is a better guide:

https://community.nxp.com/t5/S32K-Knowledge-Base/How-to-use-FreeMaster-SDKs-in-S32K3-RTD-0-9-0/ta-p/...

 

Regards

JoDo

0 Kudos
3,007 Views
Ch1
Contributor I

Thank you JoDo!!

 

Regards,

Chandana M

0 Kudos
3,322 Views
iulian_stan
NXP Employee
NXP Employee

Hi @JoDo,

One more ting you need to consider is the communication mode (it is also defined in freemaster_cfg.h)

//! Select interrupt or poll-driven serial communication
#define FMSTR_LONG_INTR         0   // Complete message processing in interrupt
#define FMSTR_SHORT_INTR        0   // Queuing done in interrupt
#define FMSTR_POLL_DRIVEN       1   // No interrupt needed, polling only

I will assume that it is Poll Driven (as in the snippet above) - it is easier to use as it does not require setting up any interrupts. Note: in case of the other two, you would need to install `FMSTR_SerialIsr` as LPUART callback function.

Note that FMSTR_LPUART_BASE, FMSTR_TRANSPORT, FMSTR_SERIAL_DRV only "inform" FreeMASTER Driver what communication will be used. You still need to configure the uart peripheral (clock, pin muxing) in your code.

Regarding FMSTR_Init and FMSTR_Poll functions:
* FMSTR_Init should be called once in your main function after the peripheral configuration
* FMSTR_Poll should be called periodically (either in a loop or a timed interrupt) depending when you want FreeMASTER driver to process the data it receivers over UART. Here is a simple template of how your main function may look like:

int main(void) {
  /* Initialize chip clock */
  CLOCK_Init(...);

  /* Enable all on-chip peripherals */
  MCME_PeriphCtrl(...);

  /* Pin muxing */
  SIUL_Init(...); /* LPUART13_RX */
  SIUL_Init(...); /* LPUART13_TX */

  /* LPUART13 Init */
  LPUART_Init(LPUART13, ...);

  /* Initialize FreeMASTER */
  FMSTR_Init();

  for (;;) {
    /* FreeMASTER poll function */
    FMSTR_Poll();
  }
 
  return 0;
}
3,305 Views
JoDo
Contributor III

Hello Iulian,

thank you very much for the detailed description. It helped me a lot. 

I tried it and it works on the first try.

Thanks again!

 

Regards,

JoDo

0 Kudos