Connection to target microcontroller error

5 Ansichten (letzte 30 Tage)
Mohamad Nazir
Mohamad Nazir am 27 Dez. 2023
Kommentiert: Mohamad Nazir am 5 Jan. 2024
Hi,
I designed an interrupt-based model for object code generation to the target microcontroller including blocks from the target support package. When I hit the build button in the hardware pane the code is built:
Code generation targets built:
Model Action Rebuild Reason
==================================================================================
ES_Application Code generated and compiled. Rebuild option is set to 'Always'.
Top model targets built:
Model Action Rebuild Reason
============================================================
PIL_Model Code compiled. Referenced models were updated.
2 of 2 models built (0 models already up to date)
Build duration: 0h 0m 13.534s
however I get the following error just below that:
Error:An asynchronous sample time is specified for the component (PIL_Model). However, this is not supported for:
a) SIL/PIL block simulations
b) Top-model SIL/PIL simulations (unless the component is an export-function model)
To avoid this error, use an alternative sample time, for example, discrete sample time. Alternatively, consider running this component in Model block SIL/PIL mode.
Then when I try to connect to run on hardware by clicking on connect the build fails and I get the following error:
Error:Unable to update models referenced by 'PIL_Model'.
Caused by:
The model 'untitled' is configured to run in external mode, but the referenced models below are out of date. If an external mode simulation is not required, set 'SimulationMode' to 'normal'. Otherwise, regenerate the code for 'PIL_Model'.
Rebuild option is set to 'Always'.
Does anyone have an idea what the error is actually about? I get that it is related to the asynchronous sample time due to the interruptions but it doesn't make much sense since the execution domain is set to discrete in the Execution pane of the property inspector.
Thanks in advance,

Antworten (1)

Asim
Asim am 3 Jan. 2024
Hello Nazir,
I understand you are encountering errors related to asynchronous sample time when trying to build your Simulink model for PIL simulation on a target microcontroller, as well as issues with updating referenced models. The error messages indicate two separate issues.
For the first error regarding asynchronous sample times, it seems that your PIL_Model contains a component or block that has an asynchronous sample time specified. This is not supported in the SIL/PIL simulation modes you are using, except for export-function models in Model block SIL/PIL mode.
Here are the steps to resolve this issue:
  1. Convert to Discrete Sample Times: Ensure all blocks within PIL_Model use discrete sample times.Please Refer to the below link for guidance on how to specify sample times in Simulink. https://in.mathworks.com/help/simulink/ug/how-to-view-sample-time-information.html
  2. Use Model Block SIL/PIL Mode: If the model is an export-function model, consider using Model block SIL/PIL mode, which supports asynchronous events.
For the second error related to the failure to update models referenced by 'PIL_Model':
  1. Rebuild Referenced Models: Ensure all referenced models are up to date by rebuilding them.
  2. Align Simulation Modes: Check and align the SimulationMode of the top model and referenced models. If external mode is not required, set the SimulationMode to 'normal'.
  3. Adjust Rebuild Settings: If the rebuild option is set to 'Always', consider changing it to a conditional setting to avoid unnecessary rebuilds.
Please refer this document on Model Reference for instructions on working with referenced models.
If after following these steps the issue persists, please provide more details about the configuration of your blocks, especially those related to the asynchronous sample time, and any additional information about the model structure.
Best Regards,
Asim Asrar
  1 Kommentar
Mohamad Nazir
Mohamad Nazir am 5 Jan. 2024
Hello Asim,
Thank you for your answer.
Effectively I have interrupt blocks which introduce asynchronous sample times not discrete ones, and the goal is to generate the code for these blocks as well as the application (which is implemented in reference model), and run a PIL simulation. I get the same error mentioned in the question whether I try to generate the code from the hardware toolstrip or run a PIL simulation from SIL/PIL manager. It is basically the same concept as the example in the link below, which is why I do not get why asynchronous time would not be allowed.
https://www.mathworks.com/help/ecoder/stmicroelectronicsstm32f4discovery/ug/Hardware-Interrupt-ISR.html
As for the second error you mentioned the three steps are already applied.
Best Regards

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by