How to write to a parameter which is part of the C-api from within simulink generated code

1 view (last 30 days)
We are working on an automatic calibration routine that will live inside a simulink model. The simulink model runs on a STM32 code platform besides other embedded code in a 5Khz step calculation.
Normally the model uses a simulink.parameter variable as input with correction values. We have access to this interface via the C-api.
When doing a factory calibration, this simulink.parameter must be teached by running a calibration routine which is part of the simulink model itsself.
Now we have a rather complicated approach:
  • after modelinit we load the earlier stored settings from flash and put it in the simulink.parameter
  • we trigger the model to run our calibration routine.
  • The calibration routine creates based on the simulink.parameter a new output signal with corrected values.
  • STM32 embedded code outside of simulink reads the output signal with test point (so it is a tracing signal in the c-api) and writes it back to the simulink.parameter via the C-api.
The goal was to have an updated simulink.parameter, but we were not able to do this write from within simulink. We would like to get rid of the extra required test point and STM32 embedded code to detect change of output data and update the simulink.paramter. That would minimize the solution back to just init from Flash and save to Flash with external code.
Any ideas?
We have looked into Data Store Memory, but it does not seem to have a feature to link to a simulink.parameter or other data type that ends up in the generated C-api interface. We use the C-api to interface with the STM32 coding platform and a self written RS232 rapid prototyping interface.

Answers (0)

Products


Release

R2015a

Community Treasure Hunt

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

Start Hunting!