SPRAD72 February   2023 TMS320F28388D , TMS320F28388S , TMS320F28P650DH , TMS320F28P650DK , TMS320F28P650SH , TMS320F28P650SK , TMS320F28P659DK-Q1

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction of SMI
  4. 2PHY Selection and Configuration for EtherCAT
  5. 3How to Read and Write to the PHY Register Using SMI of ESC
    1. 3.1 PHY Register Configuration for EtherCAT
    2. 3.2 Steps to Read or Write PHY Register in C2000 ESC
    3. 3.3 Using the Script to Debug Ethernet PHY Register in CCS
  6. 4Summary
  7. 5References

Using the Script to Debug Ethernet PHY Register in CCS

GUID-51E9DAC2-DD7F-4FD8-9914-374C1F854478.html#GUID-51E9DAC2-DD7F-4FD8-9914-374C1F854478 described the method to read and write the PHY register with C2000 ESC. To simplify the approach, a script can be used to read or write the PHY register dump and print in the console window in CCS during the debug phase.

The General Extension Language (GEL) can be used to configure the Code Composer Studio™ development environment and to initialize the target CPU. GEL is an interpreted language, and the syntax is similar to that of C. A rich set of built-in GEL functions are available, or custom GEL functions can be written. This document describes ways to create well-written GEL start-up files. For a summary of recommendations, see GEL Guidelines.

The step-by-step guide is detailed in the following list:

  1. Config the correct PHY address and cores (c28x or cm) ready to use in C2000_ESC_PHY_READ.gel
  2. Add GEL file using Tools > GEL Files > Load GEL option
  3. After initializing PHYs and ESC SMI (for example; run f2838x_cpu1_pdi_hal_test_app), then run the script using Scripts > ESC SMI configuration > C2000_ESC_PHY_Reg_Dump
GUID-20230209-SS0I-ZCZM-XRDB-RV0D4BB6GGXC-low.jpg Figure 3-1 Script Interface

Frequently accessed GEL functions can be added to the GEL menu of the Code Composer Studio menu bar as shown in #GUID-F80DB2E5-2210-4A4C-B6AD-89D44C419502. To do this, use the "menuitem" keyword to create a new drop-down list of menu items under the GEL menu. Then use the keywords "hotmenu", "dialog", or "slider" to add new menu items in the most recent drop-down list. When the user-defined menu item is selected (under the GEL menu), a dialog box or slider object appears. The example code follows:

menuitem "ESC SMI configuration";
hotmenu C2000_ESC_PHY_Reg_Dump()
{}

The method of reading and writing registers in the gel file needs to be rewritten because there is no intervention of library functions. The example code follows:

ESC_readWordISR(unsigned short wordValue, unsigned short address)
{
unsigned short *p_address;
p_address = (unsigned short *) address;
wordValue = *p_address;
}
ESC_writeWordISR(unsigned short wordValue, unsigned short address)
{
unsigned short *p_address;
p_address = (unsigned short *) address;
wordValue = *p_address;
}

Finally, find the PHY register dump in the console window as #GUID-C1752419-4012-4F52-9A88-B56CC44D7642 shows.

GUID-20230209-SS0I-D6ZP-G9VD-GKM2SRRXDXWB-low.jpg Figure 3-2 F28388 Control Card With DP83822 Register Dump