NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. 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
This wiki is open and can be edited by all! More information available @ www.ti.com/launchpad
|
By following these instructions you can modify the HALCoGen Ethernet Driver and lwIP Integration Demonstration to work on the TMS570LC4357 Launchpad.
- Make sure you have HALCoGen Installed and Updated.
- Download lwIP_Demo_v03
- Run the installation program, noting your installation folder. We'll call this '<install_dir>' in the following steps.
- Navigate to the folder '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00'
- Copy the TMS570LC43x folder to a folder named '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/LAUNCHXL2-570LC43'
- Start a HALCoGen session.
- From HALCoGen, open the project '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/LAUNCHXL2-570LC43/HALCoGen-TMS570LC43x/HalCoGen-TMS570LC43x.hcg'
- Make the following changes to the HALCoGen Project:
- TMS570LC4357ZWT / Driver Enable Tab
We need to enable the GIO Driver
- Check "Enable GIO Driver".
- Confirm GIO, SCI1, and EMAC drivers are enabled.
- 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.
- 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.
- 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
- 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
- Save your modified HALCoGen Project
- Press "F5" or Choose File->Generate Code from The HALCoGen menu
- Exit HALCoGen
- Launch Code Composer Studio
- Import the project you just modified
- From the Project Menu, choose "Import CCS Projects"
- Select 'search-directory'
- Browse to the folder '<install_dir>/HALCoGen EMAC Driver with lwIP Demonstration/v00.03.00/'
- From the list of projects available to import - select "Build-TMS570LC43x"
- Make a copy of the original project, naming it "Build-LAUNCHXL2-570LC43"
- In CCS's Project Explorer, select the project "Build-TMS570LC43x"
- Use CTRL-C, CTRL-V or the context menu to copy / paste the project
- For the new project use the name "Build-LAUNCHXL2-570LC43".
- Change the HALCoGen Project included by your new project
- Select your new project, 'Build-LAUNCHXL2-570LC43', in CCS's Project Explorer
- If not expanded, expand the tree under this project
- Select the folder "HALCoGen-TMS570LC43x". The folder icon should indicate that it is a linked resource.
- From the context-menu, select "Properties" for the folder "HALCoGen-TMS570LC43x".
- With "Resource" selected, press "Edit" and change the Location to: ORIGINAL_PROJECT_ROOT\..\..\LAUNCHXL2-570LC43\HALCoGen-TMS570LC43x
- Make sure the Resolved Location displayed matches the HALCoGen project that you edited in step 7.
- Change the PHY Id to match the DP83630 Precision PHYTER on the launchpad.
- From your "Build-LAUNCHXL2-570LC43" CCS project, navigate to and open for editing "HALCoGen-TMS570LC43x\include\HL_phy_dp83640.h"
- Change the last "USER CODE" block in the header file, so that it reads:
- Add Code to initialize GIOA[3] and GIOA[4] (To release the PHY)
- From your "Build-LAUNCHXL2-570LC43" CCS project, navigate to and open for editing "HALCoGen-TMS570LC43x\source\HL_sys_main.c"
- Add an include directive for "HL_gio.h", so that the first USER CODE block reads:
- Add a call to gioInit() to main() so that the third user block reads:
- Recommended Step: Switch to Linker Generated ECC
- Rebuild your project
- Change the target configuration to use the Launchpad's XDS110 Emulator
- Open the target configuration file targetConfigs\TMS570LC43xx.ccxml from your project by double clicking it.
- On the BASIC tab, under General Setup, change the Connection to: Texas Instruments XDS110 USB Debug Probe
- Confirm that the Board or Device is still set to "TMS570LC43xx"
- Save the Configuration
- Plug in your LaunchPad's USB Cable
- Load your project onto the launchpad and test it out!
/* 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 */
/* USER CODE BEGIN (1) */ #include "HL_gio.h" extern void EMAC_LwIP_Main (uint8_t * emacAddress); /* USER CODE END */
/* USER CODE BEGIN (3) */ gioInit(); EMAC_LwIP_Main(emacAddress); /* USER CODE END */