How to test a model that was flashed on MPC5748G using PEMicro driver and OpenSDA debugger

cancel
Showing results for 
Search instead for 
Did you mean: 

How to test a model that was flashed on MPC5748G using PEMicro driver and OpenSDA debugger

173 Views
Contributor I

I flashed a model in simulink using NXP MPC57xx toolbox, the built-in OpenSDA debugger, S32 Design Studio. Now I want to test that model on the board. Does the NXP MPC 57xx toolbox provide some means of sending inputs to the model flashed and getting output out of it?

0 Kudos
3 Replies

11 Views
Contributor I

Is there a manual or a tutorial on how to use Matlab's Processor-In-the-Loop (PiL) method for testing and verification of the flashed code that was generated from the model and deployed on NXP-MPC5748G board?

0 Kudos

11 Views
NXP Employee
NXP Employee

Hello elhariry@jaguarlandrover.com‌.

We already have an example in the MBDT Toolbox but I will attach and present here a short tutorial.

So PIL works like this: you need to create two models: the main one and a referenced one. For the main model I will name it 'top' (sim_pil_top_TC_mpc574x) and I will name the referenced model as 'target' (sim_pil_tg_TC_mpc574x).

This examples emulates HALL sensors signals, providing to the target the rotation Direction and PWM Duty Cycle, while the target will return back to the host the computed PWM representation.

For the top model, the example uses a model reference, the one which will be run on the board. The top model will run on the host and will exchange data through UART connection.

pastedImage_1.png

The following model is the target model, the one which will run on the MCU. Here you can see that it contains the config block, and the program that it will execute.

pastedImage_2.png

What is it important here is the config block. Here you need to select the target mcu type, package and sram size. Obviously you need to select in the Build Toolchain the compiler you want to use. 

pastedImage_3.png

Target Connection tab is the most important one when it comes to PIL. You need to select the PIL Download mode.

The Serial subsystem provides the computer port on which the board is connected. For me, the board was linked to COM21, but it will choose another board on your PC. The baudrate represents the speed used for board flashing. Before you run this, you need to program the board with a bootloader. This means that you need to open Design Studio for PA and flash the right rbf for your board. You can find the rbf in the toolbox installation under the following path src\tools\BootLoader\RBF_Files.

The Pil settings represents the board Serial on which will communicate with the host PC. I used the MPC5748G-DEVKIT and the settings are Serial2 PC8/PC9.

pastedImage_4.png

Now you need to save and close the target model.

Go back to the top model, and if you are working to a new model, you need to set the referenced model to PIL mode. For the model attached it is not necessary, because I already did that. To set, you need to select the referenced model, go to Tools and select, as in the image, 'To PIL Mode on MPC574x'. 

 pastedImage_5.png

All this been set, now you need to run the code. Press the 'RUN' button and wait to generate and build the code. When the code has been compiled, a window will appear. Now you need to reset the board and press the OK button.

pastedImage_6.png

pastedImage_7.png

pastedImage_8.png

The bootloader will erase and flash the board. After this process is complete. The code will be run and the data transferred back to the host.

pastedImage_10.png

When the process is complete, if you open the Scope, the same results as in the attached image will be displayed. 

Obviously this is a simple example, but the workflow for your need will be the same. 

If you have any other questions, feel free to reply here. 

Another nice tool you can use is the FreeMaster. But you should choose it depending to your use case.

Hope this helps,

Marius

0 Kudos

11 Views
NXP Employee
NXP Employee

Hello elhariry@jaguarlandrover.com‌,

For all the parts that NXP MPC57xx toolbox supports, you can achieve the communication you need in two ways:

1. Using the Matlab's Processor-In-the-Loop (PIL) method in which the model automatically generates, compiles, flashes the code on the board and exchanges data with the board for later results comparison or code profiler. You can find a some examples in the pil example folder. This method uses the UART serial communication.

2. Using NXP's  FreeMASTER Run-Time Debugging Tool | NXP  which comes with MBD toolbox. This is a real-time debug monitor and data visualization tool, enabling run time configuration and tuning of applications. Most of our application examples already comes integrated with FreeMaster for data visualization on the user's computer. The communication can be achieved over Serial communication or CAN. 

Hope this helps,

Marius

0 Kudos