LaunchXL-F28379D in External Mode. I only got last few values when I save a signal "To Workspace", any idea of the reason?

19 ビュー (過去 30 日間)
Hi,
I'm using a LaunchXL-F28379D with MATLAB-Simulink and the Hardware Support Package for the C2000 processors.
So far I'm very happy with everything I can do but I've encountered a problem when sending data to workspace.
My model just reads data from an analog input every 0.01 seconds and applies a couple of simple operations. With the scope I can see the values in real time without any problem for a long period of time, but if I try to send them to workspace with the corresponding block only the last 6 values are stored. I send them as "Structure With Time" (Timeseries is not available in External Mode).
I attach the model in .mdl format because .slx files are not permitted, if someone wants the .slx (which is the one I'm working with) I can provide it with an external link..
Values of the constants if someone wants to reproduce it:
% Init LaunchXL-F28379D values
ADC_REFHI_mV = 3000; % Fixed by PCB routing
ADC_RESOL = 4096; % For single ended 12 bit resolution
ADC2mV = ADC_REFHI_mV/ADC_RESOL;
% Init mapping into percentage
valueMin_mV = 820; % Result of test
valueMax_mV = 2540; % Result of test
What I've tried:
  • By default I have the Limit data points to last unchecked in the Model Parameters and set to inf in the specific block. If I change them to a specific number(like 100 or 1000 values) then I only got the last 2 values in the structure.
  • If I change the "Save format" to "Structure" or "Array" I get the same result: only the last 6 points.
  • The solver uses "Fixed-step" type with "Fixed-step size" set to "auto". I tried changing it to 0.005 seconds and 0.001 seconds and then I only get the last value to workspace.
I'm wondering whether the cause may be something related with some kind of dynamic memory or serial communication problem...
If I use an Arduino Uno with the same model (using the corresponding Arduino ADC block) I can get a huge amount of points stored into a workspace variable, so I think this board should be capable of doing so as well.
Thank you very much.
Josep.

回答 (1 件)

Venkatesh Chilapur
Venkatesh Chilapur 2018 年 4 月 18 日
Hi Josep,
Use a hardware trigger for ADC conversion and see if it helps. I have model attached in which I am triggering ADC conversion using ePWM module with high sample rate. Please let us know if this helps. The Model will log data in .Mat file and this is inline with workflow as described at the below link:
https://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/examples/parameter-tuning-and-signal-logging-with-serial-external-mode.html
Regards, Venkatesh C
  2 件のコメント
Josep Guasch
Josep Guasch 2018 年 4 月 18 日
Thanks a lot Venkatesh Chilapur, but could you upload the Simulink model as a R2017a compatible file? I'm working with R2017a and it says the model cannot be opened as it was created with R2017b.
Do you think the MATLAB version may have something to do with my problem? If it is necessary I can update to the latest version (my license allows me to) but I haven't yet as I have plenty of projects working fine with the current one.
Madhu Govindarajan
Madhu Govindarajan 2018 年 4 月 18 日
Hi Josep, you should be able to open a model created in a newer version if you disable the warnings. To do this, when you have a Simulink model open click on File -> Simulink Preferences. In the new window that opens up, click on Model File and then disable the check box associated with "Do not load models created with a newer version of Simulink".
HTH, Madhu

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by