NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

LAUNCHXL2 570LC43: lwIP Demo

From Texas Instruments Wiki
Jump to: navigation, search




LaunchPad Resource Portal  LaunchPadRocket.png


This wiki is open and can be edited by all!

More information available @ www.ti.com/launchpad


LaunchPad Banner.jpg

By following these instructions you can modify the HALCoGen Ethernet Driver and lwIP Integration Demonstration to work on the TMS570LC4357 Launchpad.

  1. Make sure you have HALCoGen Installed and Updated.
  2. Download lwIP_Demo_v03
  3. Run the installation program, noting your installation folder. We'll call this '<install_dir>' in the following steps.
  4. Navigate to the folder '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00'
  5. Copy the TMS570LC43x folder to a folder named '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/LAUNCHXL2-570LC43'
  6. Start a HALCoGen session.
  7. From HALCoGen, open the project '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/LAUNCHXL2-570LC43/HALCoGen-TMS570LC43x/HalCoGen-TMS570LC43x.hcg'
  8. Make the following changes to the HALCoGen Project:
    1. TMS570LC4357ZWT / Driver Enable Tab

      We need to enable the GIO Driver

      • Check "Enable GIO Driver".
      • Confirm GIO, SCI1, and EMAC drivers are enabled.
    2. TMS570LC4357ZWT / ECLK Tab

      We need to provide a 25MHz Clock to the Phy

      • In the ECLK Pin Mode Group - Change the ECLK pin Mode to ECLK
      • In the ECLK pin Group - make sure DIR is checked
      • In the ECLK Functional Configuration group, change Divider to 3 so that ECPCLK is 25MHz
      • Also check the "Continue on suspend" button.
    3. PINMUX / Pin Muxing Tab

      We need change the MII and MDIO interface pins to their default locations

      • Make sure MII is checked in the Enable/Disable Peripherals Group at the top of the PINMUX. This is necessary to put the MAC in MII mode, even though it will also move the MII pins to their alternate location - which we will have to undo manually.
      • Uncheck the MII and MDIO signals on Balls A14, B4, B11, D19, E18, F3, G3, G19, H18, H19, J18, J19, K19, N19, P1, R2, and V5. These rows should now be blank, although you can select non-ethernet functions if desired instead.
      • Change the selection on balls T4, U7 to the default functions (from MII_RX_AVCLK4 to MII_RXCLK, and from MII_TX_AVCLK4 to MII_TX_CLK). The phy will provide these clocks to the MAC on the launchpad.
    4. PINMUX / Input Pin Muxing Tab
      • We need to change all of the input MII and MDIO signals to the Default (left Column) states:
      • MDIO=F4, MII_COL=W4, MII_CRS=V4, MII_RX_DV=U6, MII_RX_ER=U5, MII_RXCLK=T4, MII_RXD[0]=U4, MII_RXD[1]=T3, MII_RXD[2]=U3, MII_RXD[3]=V3, MII_TX_CLK=U7
    5. GIO / Port A Tab
      • We need GIOA[3] and GIOA[4] to be driven high, to release the phy from reset and power down.
      • Check the "DIR" box for Bit 3 and Bit 4
      • Change DOUT to '1' for Bit 3 and Bit 4
    6. Save your modified HALCoGen Project
    7. Press "F5" or Choose File->Generate Code from The HALCoGen menu
    8. Exit HALCoGen
  9. Launch Code Composer Studio
  10. Import the project you just modified
    1. From the Project Menu, choose "Import CCS Projects"
    2. Select 'search-directory'
    3. Browse to the folder '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/'
    4. From the list of projects available to import - select "Build-TMS570LC43x"
  11. Make a copy of the original project, naming it "Build-LAUNCHXL2-570LC43"
    1. In CCS's Project Explorer, select the project "Build-TMS570LC43x"
    2. Use CTRL-C, CTRL-V or the context menu to copy / paste the project
    3. For the new project use the name "Build-LAUNCHXL2-570LC43".
  12. Change the HALCoGen Project included by your new project
    1. Select your new project, 'Build-LAUNCHXL2-570LC43', in CCS's Project Explorer
    2. If not expanded, expand the tree under this project
    3. Select the folder "HALCoGen-TMS570LC43x". The folder icon should indicate that it is a linked resource.
    4. From the context-menu, select "Properties" for the folder "HALCoGen-TMS570LC43x".
    5. With "Resource" selected, press "Edit" and change the Location to: ORIGINAL_PROJECT_ROOT\..\..\LAUNCHXL2-570LC43\HALCoGen-TMS570LC43x
    6. Make sure the Resolved Location displayed matches the HALCoGen project that you edited in step 7.
  13. Change the PHY Id to match the DP83630 Precision PHYTER on the launchpad.
    1. From your "Build-LAUNCHXL2-570LC43" CCS project, navigate to and open for editing "HALCoGen-TMS570LC43x\include\HL_phy_dp83640.h"
    2. Change the last "USER CODE" block in the header file, so that it reads:
    3. /* USER CODE BEGIN (2) */
      /* @todo @fixme:  This is a dirty hack, but it minimizes changes for now */
      #undef DP83640_PHY_ID
      #define DP83640_PHY_ID  (0x20005CE1u)
      /* USER CODE END */
      
  14. Add Code to initialize GIOA[3] and GIOA[4] (To release the PHY)
    1. From your "Build-LAUNCHXL2-570LC43" CCS project, navigate to and open for editing "HALCoGen-TMS570LC43x\source\HL_sys_main.c"
    2. Add an include directive for "HL_gio.h", so that the first USER CODE block reads:
    3. /* USER CODE BEGIN (1) */
      #include "HL_gio.h"
      extern void EMAC_LwIP_Main (uint8_t * emacAddress);
      /* USER CODE END */
    4. Add a call to gioInit() to main() so that the third user block reads:
    5. /* USER CODE BEGIN (3) */
      gioInit();
      EMAC_LwIP_Main(emacAddress);
      /* USER CODE END */
  15. Recommended Step: Switch to Linker Generated ECC
  16. Rebuild your project
  17. Change the target configuration to use the Launchpad's XDS110 Emulator
    1. Open the target configuration file targetConfigs\TMS570LC43xx.ccxml from your project by double clicking it.
    2. On the BASIC tab, under General Setup, change the Connection to: Texas Instruments XDS110 USB Debug Probe
    3. Confirm that the Board or Device is still set to "TMS570LC43xx"
    4. Save the Configuration
  18. Plug in your LaunchPad's USB Cable
  19. Load your project onto the launchpad and test it out!