Quick Troubleshooting Guide: Executing TI C2000 Simulink Models in External Mode

84 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 12 Apr 2023
Edited: MathWorks Support Team on 13 Apr 2023
The following issue(s) are frequently seen to be the reasons for failing to run the given model in external mode. Overview of topics covered in this article:
  1. Issues with XDS Virtual COM Port
  2. Issues with GPIO Pin Assignment for SCI-A
  3. Issues with Board Jumper/Switch settings
  4. Issues with Serial Baud Rate Settings
  5. Issues with Memory Overflow
  6. Extra Tips
  7. Tips on Improving Performance Issues
  8. General issues
1. Issues with XDS Virtual COM Port
When TI Code Composer Studio is properly installed and a TI board is connected to the host via USB cable, the XDS debug probe should appear in Windows Device Manager, like in the images below. 
Sometimes a conflict with other FTDI devices may result in XDS showing up with an error in the Device Manager. To re-install the correct FTDI drivers please follow the below steps:
  1. Right-click on node "XDS100 Channel A" or "XDS100 Class Debug Port" on newer versions.
  2. Select 'Update Driver Software' > 'Browse my computer for driver software'.
  3. Select 'Let me pick from a list of device drivers on my computer'. If the drivers are already installed, the XDS100 Class Debug Port drivers will show. Select this one. Otherwise, repeat but skip this step.
  4. Click on Browse and select the directory: C:\ti\ccsv7\ccs_base\emulation\windows\xds100_drivers
  5. Repeat for "XDS100 Channel B".
If Windows refuses to update the driver, they need to be fully removed:
  1. Right-click on node "XDS100 Channel A".
  2. Select 'Uninstall...'.
  3. Check the box 'Delete the driver software for this device' and click OK.
  4. Repeat for "XDS100 Channel B".
  5. Do the procedure above to reinstall the drivers.
Please note that the TI XDS reference design uses port A of the FTDI for JTAG, which leaves port B available for use as UART. It is this COM port that is used by the host for external mode operation. To load the Virtual COM port corresponding to XDS Port B (UART), refer to the section ’Additional Information’ at the following link: XDS100 (ti.com).
Here is the link specific to XDS110: XDS110 (ti.com) .Update the COM port in MATLAB/Simulink:
To update the COM port value corresponding to TI XDS100 Channel B (or XDS100 Class Auxiliary Port on newer versions) in Simulink, go to Model Configuration Parameters > Hardware Implementation >Target Hardware Resources, and select External mode > Serial port.
Starting with R2020b, this COM port is automatically detected by Simulink. You can select the required COM port from the drop-down. Click 'Refresh' to see the latest serial port value stored in the MATLAB Preferences for the given hardware board, and the updated list of serial ports available from Device Manager.
The COM port value will be saved as MATLAB preference for a given target, and not in the model. For example, if you choose the same target for a new model, the serial port saved in MATLAB preferences will be selected automatically. 
2. Issues with GPIO Pin Assignment for SCI-A
Since external mode makes use of the SCI-A (default) serial port, ensure the GPIO pins are configured such that they match the ones that are available on the board you are using. 
These are the same GPIO pins as available on the F28379D LaunchPad and it is through these pins that the SCI-A module of the controller is connected to the USB emulator (FTDI chip). 
3. Issues with Board Jumper/Switch settings
Switch or jumper settings on the LaunchPad or ControlCards can control if the GPIO pins for SCI-A are routed to the USB emulator or to the onboard headers. We need make settings such that GPIO pins are routed to the USB emulator. For example: 
On the F28069M launchpad, a combination of JP6 (MUX_SEL) and JP7 (CH_SEL) control the routing of the GPIO pins as shown in the tables below:
To enable the GPIOs 28 & 29 for serial over USB emulation operation and for external mode to work, we need to reverse the Jumper settings against the settings shown in the picture above. Refer to your board schematic for more details on such settings.
Please look for such switch settings if external mode is not working, especially with the below error message:
If the above error persists, check for the basic serial communication on the given serial module between the host and target and ensure the same works before proceeding.
4. Issues with Serial Baud Rate Settings
Increasing the baud rate can improve the overall external mode performance and solve issues like data drop. For baud Rate settings, navigate to Hardware Implementation > Target Hardware Resources > SCI_A and specify the baud rate in Desired baud rate in bits/sec.
Note that from R2020b, you can select between any available serial modules.
You can increase the baud rate of the serial-over-USB of your Launchpad or ControlCard. On LaunchPads and ControlCards using FTDI 2232H, you can select any baud rate less than or equal to 6 Mbps, or exactly 9 or 12 Mbps. On ControlCards using FTDI 2232D, you can select any baud rate less than or equal to 1.5 Mbps, or exactly 2 or 3 Mbps.
5. Issues with Memory Overflow
See the section ’Logging signal data using a signal trigger’ on the following documentation page:
https://www.mathworks.com/help/releases/R2022b/supportpkg/texasinstrumentsc2000/ug/parameter-tuning-and-signal-logging-with-serial-external-mode.html
Increasing the Duration allows the capture of large real-time buffers. These buffers use heap section to allocate memory. A high value of 'Duration' may result in the warning:\n
Not enough memory on the target to process the packet
and consequently cause no data to be uploaded from the target to the host computer. To overcome this warning, specify a larger heap size if your target has sufficient memory. To change the heap size, browse to Model Configuration Parameters > Code Generation > Build Configuration > Specify > Linker and modify the value of --heap_size.
Please refer to the below page for more information on editing the Linker command file to increase the system RAM memory if more heap needs to be allocated:
How to resolve error 'Not enough memory on the target to process the packet' while working on TI C2000 in external mode? - MATLAB Answers - MATLAB Central (mathworks.com)
For targets with small RAM such as F28027, the code has to be booted from flash.
6. Extra Tips
  • Ensure MATLAB is started in admin mode and no other applications such as Code Composer Studio (CCS) are connected to the board.
  • Ensure the model is configured to run in external mode and the simulation time is set to a large value (such as ‘Inf’, which means infinity) as highlighted in the figure below. If the value is not 'Inf', the external mode simulation runs till the specified simulation time and then stops. It may not work for lower simulation times like 10-15 seconds. Click the green 'Run' button to run the model in external mode.
  • Parameter tuning and signal logging for 8-bit data types is not supported over serial external mode for Texas Instruments C2000 processors.
  • An error stating "Attempting to establish connection with hostname 127.0.0.1 through port ..." indicates that either the COM port or the TCP/IP port 17725 on the local loopback are held by some other application. Ensure that the ports are available before launching external mode. External mode uses a process in the background to buffer data and improve data logging. This process needs port 17725.
  • When using a serial connection like DB9 connector on Spectrum eZDSP boards, use the COM1 port of Host PC for external mode connection.
7. Tips on Improving Performance Issues
  • If you observe breaks in the scope traces, you can try the following to improve logging performance:
    • Increase serial baud rate
    • Decrease the number of signals selected for logging
    • Decrease the model base rate
  • When running external mode, be careful not to increase the acquisition frequency beyond the functional range of 10kHz. Please refer to the MATLAB Answer post below which gives details on modeling workarounds using Rate Transition block and DSP buffer blocks that can help step the acquisition frequency up to 50KHz on a F28379D board. The same underlying concept can be used on any board.  The link below also contains information on the 2model approach which is seen as an alternative to external mode simulation for fast data logging up to 200kHz.
https://www.mathworks.com/matlabcentral/answers/353179-how-to-increase-acquisition-frequency-in-real-time-ti-board-f28379d
8. General issues
  • If you cannot run your model in CCP external mode, please compare the model configuration settings from our example model with your model. For example: As CAN external mode is dependent on custom storage class canlib.signal, we should not select ‘Ignore custom storage class’ in the Interface pane under Code Generation. For details on custom storage class canlib.signal please refer the documentation page:
https://www.mathworks.com/help/releases/R2022b/supportpkg/texasinstrumentsc2000/target-hardware.html
  • Signals that are coming out of function call (triggered) subsystems or signals inside function call subsystems are currently not supported for logging due to asynchronous behavior. One workaround for this issue is to log outside the triggered subsystem after adding a rate transition block before logging.
  • For external mode over CAN, note that our examples are tested to work with hardware from Vector only. Please refer to the following MATLAB Answers post for more information:
https://www.mathworks.com/matlabcentral/answers/431853-ecan-loading-problems-to-ti-c2000-c28x3x-card-are-example-only-for-vector-hardware

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!