Example: Not able to run Simple PIL S32CT example

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

Example: Not able to run Simple PIL S32CT example

Jump to solution
2,019 Views
sh_dhanasekaran
Contributor II

Hello, 

I am trying out a simple PIL S32CT example with MBDT for S32K3** version 1.3.0 on Matlab 2022b. The board I am working on is NXP S32K3x4EVB-Q257. Now when I try to flash the simulink example model through PE-micro JTAG connection I get the following error in Simulink. 

sh_dhanasekaran_1-1681392984334.png

I also tried a different example from Dio S32CT which works perfectly and gets downloaded without any issue in the board. So I am confused what's going wrong.

Also under Hardware Implementation --> Target Hardware Resources --> PIL 
I am unable to find a serial port in the drop down. Is this the issue? If so why is it not happening with the Dio example?(even there I am unable to find a serial port) but still the code gets flashed into the hardware.

sh_dhanasekaran_0-1681391879515.png

Please help me with this! Thank you in advance

Please provide guidance on how I can resolve this.

Thank you

 

0 Kudos
Reply
1 Solution
2,009 Views
georgevictor
NXP Employee
NXP Employee

Hi, @sh_dhanasekaran,

First of all, I would like to mention that there is a difference between the deployment of the Dio application on target and a PiL simulation, described as it follows:

1. When building the Dio model, code gets generated from the application, it is cross-compiled and linked into an executable file, which is automatically downloaded onto the board, in your case via the PE-micro JTAG probe.

2. In case of a PiL simulation, beside the behavior described at 1, which also happens here: the s32k3xx_pil_target_s32ct model is built and downloaded on target, there is one more step that is performed. The application running on target is fed with inputs from the host Simulink model, which are transmitted to the board via a serial communication. Also, outputs of the application running on target are sent back to the Simulink environment to be displayed and analyzed over the same serial communication.

Therefore, this serial communication needs to be configured, both hardware and software when running a PiL simulation.

Hardware: Please connect an USB cable between the host PC and the USB2Serial converter on the EVB. In case your EVB does not have an USB2Serial please let us know if more details are required. 

Software: After making this connection press the refresh button under Hardware Implementation --> Target Hardware Resources --> PIL group and select the COM Port as identified inside Device Manager under the Ports tab on your PC.

Since for a simple application deployment, as already mentioned at point 1, there is no need to establish a serial connection, these settings should be made only in case of PiL (that's why Dio example works with no issues).

For more details on the s32k3xx_pil_target_s32ct example, please check the s32k3xx_pil_harness_s32ct_example_readme.html file found next to the model.

Cheers,

Victor

 

View solution in original post

5 Replies
2,010 Views
georgevictor
NXP Employee
NXP Employee

Hi, @sh_dhanasekaran,

First of all, I would like to mention that there is a difference between the deployment of the Dio application on target and a PiL simulation, described as it follows:

1. When building the Dio model, code gets generated from the application, it is cross-compiled and linked into an executable file, which is automatically downloaded onto the board, in your case via the PE-micro JTAG probe.

2. In case of a PiL simulation, beside the behavior described at 1, which also happens here: the s32k3xx_pil_target_s32ct model is built and downloaded on target, there is one more step that is performed. The application running on target is fed with inputs from the host Simulink model, which are transmitted to the board via a serial communication. Also, outputs of the application running on target are sent back to the Simulink environment to be displayed and analyzed over the same serial communication.

Therefore, this serial communication needs to be configured, both hardware and software when running a PiL simulation.

Hardware: Please connect an USB cable between the host PC and the USB2Serial converter on the EVB. In case your EVB does not have an USB2Serial please let us know if more details are required. 

Software: After making this connection press the refresh button under Hardware Implementation --> Target Hardware Resources --> PIL group and select the COM Port as identified inside Device Manager under the Ports tab on your PC.

Since for a simple application deployment, as already mentioned at point 1, there is no need to establish a serial connection, these settings should be made only in case of PiL (that's why Dio example works with no issues).

For more details on the s32k3xx_pil_target_s32ct example, please check the s32k3xx_pil_harness_s32ct_example_readme.html file found next to the model.

Cheers,

Victor

 

1,990 Views
sh_dhanasekaran
Contributor II

@georgevictor :Thank you for the response. I did try the above mentioned method. Now I have an error which says 

'The timeout of 10 seconds for receiving data from the rtiostream interface has been exceeded. there might be multiple reasons for this communications failure.'

Please let me know if I am doing some thing wrong here. Thank you

0 Kudos
Reply
1,917 Views
georgevictor
NXP Employee
NXP Employee

Hello, @sh_dhanasekaran,

Starting with the error message that you are currently receiving, there are a few more checks that we need to perform to identify the issue:


1. There are two models in the s32k3xx_simple_s32ct example. The model that is downloaded onto the hardware target is called s32k3xx_pil_target_s32ct, and the host model s32k3xx_pil_harness_s32ct that is used to connect Simulink to the hardware target using serial communication. In order to successfully communicate, the COM port must be set in both models.


2. Besides the COM port, in some cases we also need to change the Hardware UART selection. I'll quickly walk you through this process.

The MBDT for S32K3xx generates code based on RTD (Real Time Drivers) MCAL components. The configuration of the UART component used for serial communication is done using an external
configuration tool (S32 Configuration Tool integrated in our toolbox or the EBtresos tool that needs to be downloaded). We provide a default configuration (for both EBtresos and S32CT) for all the hardware parts supported in our toolbox. This default configuration includes multiple configured components and is used by the model during the build process.
For the PiL example mentioned above, you are using the internal configuration tool, S32CT, and a default configuration project for S32K344-Q257. In this pre-configured project that we are providing, the Uart component has two channels configured (UartChannel_0 and UartChannel_1). UartChannel_0 configures the LPUART6 instance on the board and UartChannel_1 corresponds to LPUART13.

LPUART6 is routed to the EVB's OpenSDA chip. The MCU's LPUART13 instance is connected to ChannelB of the USB2Serial converter on the EVB. When you connect the board to the PC via the USB2Serial port, DeviceManager will display two COM ports for both FTDI channels; typically, the higher COM port number corresponds to our LPUART13 instance (it depends on how Windows assigns COM port numbers).


In the following picture, you can see both the OpenSDA(1) and USB2Serial(2) ports on my S32K344-Q257 EVB revision:

georgevictor_0-1681995994681.png

In conclusion, if you are using the dedicated USB2Serial converter of the EVB, you should select UartChannel_1 inside both models' settings and start with the highest COM port number in the list. In order to successfully establish serial communication, you should check your schematic and make the necessary adjustments in the configuration project if your EVB has a different USB2Serial converter or a different board revision.


If you have any further questions or require assistance, please do not hesitate to contact me.

Cheers,
Victor

 

1,911 Views
sh_dhanasekaran
Contributor II

@georgevictor : thank you for the response. I did all the necessary steps you mentioned. Still I have the following error.

'RTIOSTREAM UART CHANNEL' - undeclared. 

Why is this error. You can find the detailed error message below 

 

0 Kudos
Reply
1,756 Views
georgevictor
NXP Employee
NXP Employee

Hi, @sh_dhanasekaran,

I see that you still encounter issues with the PiL example. I tried to replicate your errors by running the same example on my end, but I had no problems.

My suggestion for now is to start with a fresh setup for this example.

To do this you need to:

  1. Clear our default project files like  <model_name>_Config folder and the <model_name>_Config.mex configuration file as shown in the image below.georgevictor_0-1682580429649.png

 

  1. Clear also the .sldd and .mat files generated by our toolbox for the model.
  2. Clear the files generated by the PiL simulation like slprj folder, <model_name>.mexw64 file.

Sometimes, in order to delete these folders or files, you must first remove them from the Matlab path. Run 'clear mex' in Command Window to remove the.mexw64 file from the path.

georgevictor_1-1682580429681.png

 

 

My recommendation is to clean the Simulink-generated files mentioned at step 3 each time you run a new simulation.

After the cleanup is finished, open both models (a fresh default project s32k3xx_pil_target_s32ctConfig.mex and a Config folder is brought next to the model for the Hardware part selected in the model). In the Hardware Setting of the models, selected the desired Hardware part package if needed. Under Hardware Implementation --> Target Hardware Resources --> PIL press the refresh button after you have connected the usb cable to the EVB, select the COM port, select the UartChannel (UartChannel_1 if you are using the dedicated USB2Serial converter of the EVB) and press the Apply button. Don’t forget to save the models after making these changes.

 Now, run the PiL simulation from the harness example and then let's check to see if your problems persist.

 

Hope this helps,

Victor

 

0 Kudos
Reply