How to use FreeMaster and S32?

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

How to use FreeMaster and S32?

Jump to solution
4,310 Views
irmantasbudrys
Contributor III

Hello,

 

I am using S32 and FRDM-KEAZ128 development board. I would like to use FreeMaster for real time debugging. I can't find any good examples how to use FreeMaster commands in microcontroller code and how to create a project in FreeMaster. Does anyone know any good examples/tutorials?

 

Best Regards,

IB 

Labels (1)
0 Kudos
1 Solution
2,806 Views
gearhead1107
Contributor IV

Figured out the problem I was having! In my code, I was enabling the IRQ before it was installed. Lesson learned, with the LPUART configured to use interrupts, you *have* to ensure the IRQ is successfully enabled and installed to the FMSTR_Isr.

If you're having the same difficulty I was (CFG file looks okay, using FMSTR_Init() and FMSTR_Poll() in your code, but no comms), definitely assign a breakpoint in FMSTR_Isr to make sure UART commands are hitting FMSTR_ProcessSCI and it's actively handling UART messages, and go from there.

View solution in original post

0 Kudos
10 Replies
2,807 Views
gearhead1107
Contributor IV

Figured out the problem I was having! In my code, I was enabling the IRQ before it was installed. Lesson learned, with the LPUART configured to use interrupts, you *have* to ensure the IRQ is successfully enabled and installed to the FMSTR_Isr.

If you're having the same difficulty I was (CFG file looks okay, using FMSTR_Init() and FMSTR_Poll() in your code, but no comms), definitely assign a breakpoint in FMSTR_Isr to make sure UART commands are hitting FMSTR_ProcessSCI and it's actively handling UART messages, and go from there.

0 Kudos
2,806 Views
isaacavila
NXP Employee
NXP Employee

Hello Irmantas,

I think this application note can be helpful for you: http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4752.pdf. It gives a little introduction to FreeMASTER and explain how to create a new FreeMASTER project for CW (it can be almost the same for S32 studio).

Regards,

Isaac

0 Kudos
2,806 Views
gearhead1107
Contributor IV

Isaac,

I'm using the AN you linked, which is very helpful, however FreeMaster seems to be having issues connecting to my board.

So far, I've:

  • Gated the system clock to LPUART1
  • Configured pins on PTC6/7 for TX/ Recieve on LPUART1
  • Toggled FMSTR_USE_LPUART  1
  • Selected FMSTR_SHORT_INTR communication

And written the following code to test out FreeMaster:

//! Start UART
LPUART_DRV_Init(FSL_LPUART1, lpuartStatePtr, &lpuart1_InitConfig0);

//! Set LPUART IRQ to Freemaster
INT_SYS_EnableIRQ(LPUART1_RxTx_IRQn);
INT_SYS_EnableIRQ(LPUART1_ERR_IRQn);

INT_SYS_InstallHandler(LPUART1_RxTx_IRQn, &FMSTR_Isr, NULL);
INT_SYS_InstallHandler(LPUART1_ERR_IRQn, &FMSTR_Isr, NULL);

//! Start Freemaster
FMSTR_Init();

/*! Main Runtime Loop */
for(;;)

//! Get result from channel 12
ADC_DRV_WaitConvDone(FSL_ADCONV1);
ADC_DRV_GetChanResult(FSL_ADCONV1, 0U, &adcResult);

//! Poll Freemaster
FMSTR_Poll();

if ((uint32_t)((5000*adcResult)/0xFFF) > 3750U) {

/* If result > 3.75V */
GPIO_HAL_SetPins(RGB_GPIOport, (1 << RGB_G));
}
else {
GPIO_HAL_ClearPins(RGB_GPIOport, (1 << RGB_G));
}
ADC_DRV_ConfigChan(FSL_ADCONV1, 0U ,&adConv1_ChnConfig0);

}

However, when I attempt to use the connection wizard on the COM port I verified on my machine, Program running/ working, FreeMaster gives me "No board detected..." using the connection wizard, and "Cannot detect board information ... Error code: 0x80000101" hitting the stop button after configuring the project.

...Anything I missed here?

0 Kudos
2,806 Views
isaacavila
NXP Employee
NXP Employee

Hello,

You can download the FreeMASTER Serial Communication driver package from: www.nxp.com/freemaster.  Go to Downloads section and select the FreeMASTER Serial Communication.

FreeMaster Driver.jpg

On this package, you will found useful documentation that explains how to use the driver (http://www.nxp.com/assets/documents/data/en/user-guides/FMSTRSCIDRVUG.pdf) and besides, some example projects for different devices.

These example projects are located at: <FreeMASTER_Serial_Communication_Driver_V2.0>\examples\SCI_driver_examples.

I hope this can help you!

Regards,

Isaac

0 Kudos
2,806 Views
gearhead1107
Contributor IV

isaacavila‌,

I'm using S32DS v1.3 which should have FreeMaster_S32xx drivers built in based on my project. Would I still need to download the drivers, even with the add-on to the IDE?
FreeMaster.jpg
I should have mentioned, the FreeMaster functions are being used when I debug, but the application still can't see the board.

0 Kudos
2,806 Views
isaacavila
NXP Employee
NXP Employee

Hello Gearhead,

It is not necessary to download the driver, due it is already included.

Have you tried to use the example code included in S32DS?

You can try to import this project and run it on S32K144EVB, for doing this, just try next steps:

Go to File, then New, New S32DS Project from example. Select FreeMASTER example as shown below:

Import FreeMaster example.jpg

Generate code then, compile and flash the MCU and run the application.

From FreeMASTER's perspective, select the project tab and then click on Options. In the new window, select the proper Port and set baud rate to 115200.

Set connection.jpg

In the same window, got to MAP Files tab and load the .elf file from current project.This file is located at: <Project_location>/Debug_Flash/

load ELF file.jpg

After this, you can create a new scope and add any desired variable. In my case, I added the adcRawValue variable. After everything is set, just click on the STOP icon and communication with board should be set correctly.

Scope.jpg

I hope this helps, if you still have issues, just let me know it!

Regards,

Isaac

2,806 Views
fengwang
Contributor I

hello Isaac,

      I open the project as your say , the FreeMASTER example can't build because that the project has many errors , it doesn't find the heard  file in the "main.c". I can't find the heard file in my pc. I need you help !

     Regards,

     cloud

0 Kudos
2,806 Views
isaacavila
NXP Employee
NXP Employee

Hello Feng,

Which S32DS version are you using? There should be no errors in paths because this is an example project! have you tried to install other standalone SDKs?

Could you please share the project with me?

Regards,

Isaac

0 Kudos
2,806 Views
fengwang
Contributor I

Hello Isaac,

          I am using S32DS for ARM v1.3. I have solved this issue .Need to "ProcessorExpert.pe"generate processor expert code . thank you ! 

         But I have other issue about that MCToolbox & simulink , open the example in the“mctbx_S32K” ,building the model and generate code  occurs ;

        as  this:

### Starting build procedure for model: adc_pdb_trigger_s32k14
### Build procedure for model: 'adc_pdb_trigger_s32k14' aborted due to an error.
Warning: The following error was caught while executing 'coder.internal.ModelBuilder' class destructor:
Error: File: execstring Line: 1 Column: 27
Unterminated string

ME =

MException with properties:

identifier: 'RTW:makertw:licenseUnavailable'
message: [1x136 char]
cause: {}
stack: [13x1 struct]

exception id RTW:makertw:licenseUnavailable message Embedded Coder is not licensed or not installed. The current target is: C:\MCToolbox\mctbx_S32K\mctbx_s32k14\mctbx_s32k14\mcd_s32k14.tlc >>

I need you help ! thanks !

Regards,

feng

0 Kudos
2,806 Views
gearhead1107
Contributor IV

Feng, I'm no expert but that looks like an error related to your license - you should probably start a new thread so that people with the same build environment can help you..

0 Kudos