Can I modify STM32F446RE microcontroller's registers after deploying code from Simulink?

4 ビュー (過去 30 日間)

I am using Simulink Embedded Coder with an STM32F446RE high-performance microcontroller. I aim to generate code from Simulink, deploy it on the microcontroller, and then overwrite the registers in which their parameters are stored.

Is this possible through Simulink?

採用された回答

MathWorks Support Team
MathWorks Support Team 2024 年 2 月 21 日
Yes, it is possible to interact with registers when the code runs on the board. This can be accomplished by employing global variables within the Embedded Coder dictionary in Simulink.
To do this, please follow the instructions below:
1. In Simulink, navigate to MODELLING > DESIGN > Model Explorer 
2. Create a data dictionary as shown in the screenshot below:
3. Create a variable with the required name and value. 
4. Set the "StorageClass" to "Convert the parameter object" as shown in the screenshot below:
5. Specify the "StorageClass" as "ExportedGlobal" and the respective "DataType"
6. Generate and deploy the code on the board. Once the code is running, you can modify the value of the corresponding variable.
To find additional information regarding the Embedded Coder Dictionary, please refer to the documentation page below:
If you wish to have control over how the value of a variable in the deployed code is changed from the Simulink model, you can utilize the "Memory Copy" block. For more detailed information about the "Memory Copy" block, please refer to the documentation page provided below:

その他の回答 (0 件)

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by