MATLAB Answers

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

25 views (last 30 days)
Josep Guasch
Josep Guasch on 14 Apr 2018
Edited: Josep Guasch on 25 Dec 2018
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
% 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.

Answers (1)

Venkatesh Chilapur
Venkatesh Chilapur on 18 Apr 2018
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:
Regards, Venkatesh C
Madhu Govindarajan
Madhu Govindarajan on 18 Apr 2018
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!