This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] FAQ: How can I use a two model approach in MathWorks Embedded Coder for signal logging and parameter tuning on a TI C2000?

Prodigy 130 points

Replies: 0

Views: 81

MathWorks Embedded Coder with the MathWorks TI C2000 Hardware Support Package allows automatic build and execution on C2000 hardware from models developed using MATLAB and Simulink.

 

This is the fastest way to log data in realtime. In the two model approach, the idea is to create two models, one that runs on the target and sends data to serial. The second one runs on the host and gets data from the target. Here is an example of DC DC buck converter that takes this approach.

Differences between External mode and two model approach

External Mode 

Two Model approach 

Data logging supports up to a maximum rate of 20kHz. 

Data transfer supports up to a maximum rate of 200kHz. 

Ideal for 4 to 40 signals. 

Ideal for up to 3 signals. 

Additional processing required by the target for external mode. 

No additional processing is required by the target. 

Extra buffer needs to be allocated by updating "--heap_size" parameter in the configuration parameters. 

No need to allocate extra buffer size. 

When using the two model approach

The number of signals that can be logged depends on the baud rate and the rate at which the data is transferred.  For example, consider that we need to transfer 10 bytes of data at 20kHz. 

  1. 10 bytes * 20,000Hz = 200,000 bytes/s 
  2. 200,000 bytes * 10 bits/byte = 2,000,000 bits/s (baud rate) i.e, 2e6. 
  3. Then desired baud rate in this case is 2e6 i,e 2 Mbps.

 On the same lines, using two model approach, the data can be transferred at a higher rate of 200KHz. Maximum of 3 Uint16 signals can be transferred at a rate of 200KHz if the baud rate is configured as 12Mbps. 

 

Details on how to use the two model approach are available here.