Update repo

This commit is contained in:
hangpersonal committed 2026-08-30 23:04:35 -07:00
1 parent 749dab5721
commit ce65a0f59a
14950 files changed
+4408250 -1

No files matched your search

@@ -0,0 +1,3 @@
FOR ALL EXAMPLES
Please first refer to the EtherCAT Slave Controller User Guide (under docs) for usage instructions.
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cm_cia402_solution"
device="Generic CortexM4 Device"
cgtVersion="20.2.6.LTS"
products="C2000WARE"
endianness="little"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=RAM --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --stack_size=0x200 --heap_size=0x1000 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --stack_size=0x200 --heap_size=0x1000 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cm_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/startup_cm.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/cm.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/cm.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cm_echoback_solution"
device="Generic CortexM4 Device"
cgtVersion="20.2.6.LTS"
products="C2000WARE"
endianness="little"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=RAM --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --stack_size=0x200 --heap_size=0x200 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --stack_size=0x200 --heap_size=0x200 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cm_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/startup_cm.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/cm.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/cm.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cm_foe_download"
device="Generic CortexM4 Device"
cgtVersion="20.2.6.LTS"
products="C2000WARE"
endianness="little"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=RAM --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --stack_size=0x200 --heap_size=0x200 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=ETHERCAT_STACK --define=_FLASH --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --stack_size=0x200 --heap_size=0x200 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cm_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cm.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/startup_cm.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/cm.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/cm.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cm_pdi_hal_test_app"
device="Generic CortexM4 Device"
cgtVersion="20.2.6.LTS"
products="C2000WARE"
endianness="little"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=DEBUG --define=RAM --define=PDI_HAL_TEST --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --stack_size=0x200 --heap_size=0x200 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib_cm -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -mv7M4 --float_support=none -me --verbose_diagnostics --gen_func_subsections=on --embedded_constants=off --define=DEBUG --define=_FLASH --define=PDI_HAL_TEST --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --stack_size=0x200 --heap_size=0x200 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT/pdi_test_app.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cm_hal.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cm.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cm.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/startup_cm.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/cm.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/cm.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/ccs/Debug/driverlib_cm.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib_cm/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,104 @@
//###########################################################################
//
// FILE: pdi_test_app.c
//
// TITLE: EtherCAT PDI (Processor Data Interface) example for F2838x CM
//
// F2838x CM PDI Interface Test App
//
// This example tests the F2838x CM EtherCAT PDI and demonstrates usage of the
// EtherCAT CM HAL drivers. The example should be run on a F2838x controlCARD.
//
// External Connections
// The controlCARD RJ45 port 0 is connected to PC running TwinCAT master
//
// Watch Variables
// ESC_escRegs (ESC stands for EtherCAT Slave Controller) data structure will
// be constantly updated to show the latest values of the specified ESC
// registers
//
//#############################################################################
// $TI Release: F2838x EtherCAT Software v2.02.00.00 $
// $Release Date: Tue Oct 29 00:56:49 IST 2024 $
// $Copyright:
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "ethercat_slave_cm_hal.h"
//
// Main
//
void main()
{
uint16_t initStatus;
//
// Initialize CM and HAL interface
//
initStatus = ESC_initHW();
//
// Loop and signal error if initHW returns failure
//
if(initStatus == ESC_HW_INIT_FAIL)
{
while(1)
{
//
// Toggle Error
//
ESC_signalFail();
}
}
//
// Setup and perform PDI Test
//
ESC_setupPDITestInterface();
//
// Update local RAM with ESC register values for debugging
//
while(1)
{
ESC_debugUpdateESCRegLogs();
HAL_performDelay();
}
}
//
// End of File
//
@@ -0,0 +1,32 @@
<projectSpec>
<project
name="f2838x_cpu1_allocate_ecat_to_cm"
device="Generic C28xx Device"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=DEBUG --define=RAM --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --entry_point code_start --stack_size=0x200 --heap_size=0x200 " />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=DEBUG --define=_FLASH --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --entry_point code_start --stack_size=0x200 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT/f2838x_cpu1_allocate_ecat_to_cm.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,430 @@
//###########################################################################
//
// FILE: f2838x_cpu1_allocate_ecat_to_cm.c
//
// TITLE: Allocating the EtherCAT Peripheral to CM Core.
//
// F2838x EtherCAT Setup and Allocation to CM
//
// This example sets up the F2838x CPU1 device, enables and configures
// the EtherCAT peripheral then allocates it to the CM. The CM is then
// configured to boot to RAM or FLASH and released from reset.
//
// Important: Before running this example, refer to the EtherCAT Slave
// Controller User Guide in C2000Ware for the proper
// setup/execution procedure of this example
//
// External Connections
// None
//
// Watch Variables
// None
//
//###########################################################################
// $TI Release: F2838x EtherCAT Software v2.02.00.00 $
// $Release Date: Tue Oct 29 00:56:49 IST 2024 $
// $Copyright:
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//###########################################################################
//
// Included Files
//
#include "device.h"
//
// Defines
//
#define ESCSS_LOOP_TIMEOUT 0x300U
#define ALLOCATE_TO_CM 0x1U
#define ESC_USE_INT_PHY_CLK 0x1U
#define BOOT_KEY 0x5A000000UL
#define CM_BOOT_FREQ_125MHZ 0x7D00U
#define BOOTMODE_BOOT_TO_WAIT 0x0U
#define BOOTMODE_BOOT_TO_RAM 0x5U
#define BOOTMODE_BOOT_TO_FLASH 0x3U
#define CCARD_LED_1_GPIO 31U
#define CCARD_LED_2_GPIO 34U
#define CCARD_ECAT_RUN_LED_GPIO 146U
#define CCARD_ECAT_ERR_LED_GPIO 145U
//
// Function Prototypes
//
void setupESCGPIOs(void);
void configureAndReleaseCMToWait(void);
void releaseCMToApplication(void);
//
// Main
//
void main(void)
{
//
// Disable the watchdog
//
SysCtl_disableWatchdog();
#ifdef _FLASH
//
// Copy time critical code and flash setup code to RAM. This includes the
// following functions: Flash_initModule();
//
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart symbols
// are created by the linker. Refer to the device .cmd file.
//
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
//
// Call Flash Initialization to setup flash waitstates. This function must
// reside in RAM.
//
Flash_initModule(FLASH0CTRL_BASE, FLASH0ECC_BASE, DEVICE_FLASH_WAITSTATES);
#endif
//
// Verify the XTAL crystal frequency.
//
#warn "IMPORTANT: F2838x EtherCAT software is now built for XTAL source of 25MHz. Refer to the EtherCAT Software User Guide for more information"
if(!Device_verifyXTAL(DEVICE_OSCSRC_FREQ / 1000000))
{
//
// The actual XTAL frequency does not match DEVICE_OSCSRC_FREQ!!
// Please check the XTAL frequency used.
//
// Note that the latest F2838x controlCARDs (Rev.B and later) have been
// updated to use 25MHz XTAL by default. If you have an older 20MHz XTAL
// controlCARD (E1, E2, or Rev.A), refer to the controlCARD
// documentation on steps to reconfigure the controlCARD from 20MHz to
// 25MHz.
//
ESTOP0;
//
// Set LED GPIOs to output mode
//
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
while(1)
{
//
// Toggle controlCARD LEDs and delay
//
GPIO_togglePin(DEVICE_GPIO_PIN_LED1);
GPIO_togglePin(DEVICE_GPIO_PIN_LED2);
DEVICE_DELAY_US((uint32_t)(50000));
}
}
//
// Set up device clock
//
SysCtl_setClock(DEVICE_SETCLOCK_CFG);
//
// Make sure the LSPCLK divider is set to the default (divide by 4)
//
SysCtl_setLowSpeedClock(SYSCTL_LSPCLK_PRESCALE_4);
//
// Turn on all peripherals and initialize GPIOs
//
Device_enableAllPeripherals();
Device_initGPIO();
//
// Setup AUX Clock for ECAT and CM
// Configured to 500MHz raw ((25 * 20 IMULT) /1)
//
SysCtl_setAuxClock(SYSCTL_AUXPLL_ENABLE | SYSCTL_AUXPLL_OSCSRC_XTAL |
SYSCTL_AUXPLL_IMULT(20) | SYSCTL_AUXPLL_FMULT_0 |
SYSCTL_AUXPLL_DIV_1);
//
// Setup GPIOs for EtherCAT
//
setupESCGPIOs();
//
// Allocate Ethercat to CM
//
SysCtl_allocateSharedPeripheral(SYSCTL_PALLOCATE_ETHERCAT,
ALLOCATE_TO_CM);
//
// Setup CM clocks and release from reset to Wait Boot Mode
//
configureAndReleaseCMToWait();
//
// Setup EtherCAT Clocks
//
// Aux = 500MHz and use /5 to get 100MHz for ECAT IP
// (There is a built in /4 to get 25MHz for PHY when using
// internal clocking for PHY)
//
SysCtl_setECatClk(SYSCTL_ECATCLKOUT_DIV_5, SYSCTL_SOURCE_AUXPLL,
ESC_USE_INT_PHY_CLK);
//
// Set boot mode to RAM or Flash and release from Wait Boot Mode
//
releaseCMToApplication();
//
// Wait Forever
//
while(1)
{
//
// Additional CPU1 actions can be added here
//
}
}
//
// setupESCGPIOs - Setup EtherCAT GPIOs
//
// Note: These are configured for the F2838x controlCARD. For
// more pin mapping details refer to the GPIO chapter of the
// F2838x Technical Reference Manual.
//
void
setupESCGPIOs(void)
{
//
// PHY CLK
//
GPIO_setPinConfig(GPIO_154_ESC_PHY_CLK);
//
// PHY Reset
//
GPIO_setPinConfig(GPIO_155_ESC_PHY_RESETN);
//
// I2C for EEPROM
//
GPIO_setPinConfig(GPIO_150_ESC_I2C_SDA);
GPIO_setQualificationMode(150, GPIO_QUAL_ASYNC);
GPIO_setPadConfig(150, GPIO_PIN_TYPE_PULLUP);
GPIO_setPinConfig(GPIO_151_ESC_I2C_SCL);
GPIO_setQualificationMode(151, GPIO_QUAL_ASYNC);
GPIO_setPadConfig(151, GPIO_PIN_TYPE_PULLUP);
//
// P0 TX and RX DATA
//
GPIO_setPinConfig(GPIO_158_ESC_TX0_DATA0);
GPIO_setQualificationMode(158, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_159_ESC_TX0_DATA1);
GPIO_setQualificationMode(159, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_160_ESC_TX0_DATA2);
GPIO_setQualificationMode(160, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_161_ESC_TX0_DATA3);
GPIO_setQualificationMode(161, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_165_ESC_RX0_DATA0);
GPIO_setQualificationMode(165, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_166_ESC_RX0_DATA1);
GPIO_setQualificationMode(166, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_167_ESC_RX0_DATA2);
GPIO_setQualificationMode(167, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_168_ESC_RX0_DATA3);
GPIO_setQualificationMode(168, GPIO_QUAL_ASYNC);
//
// P0 TX Enable, RX DV, RX ERR
//
GPIO_setPinConfig(GPIO_156_ESC_TX0_ENA);
GPIO_setQualificationMode(156, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_162_ESC_RX0_DV);
GPIO_setQualificationMode(162, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_164_ESC_RX0_ERR);
GPIO_setPadConfig(164, GPIO_PIN_TYPE_STD);
//
// P0 TX and RX Clk
//
GPIO_setPinConfig(GPIO_157_ESC_TX0_CLK);
GPIO_setQualificationMode(157, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_163_ESC_RX0_CLK);
GPIO_setQualificationMode(163, GPIO_QUAL_ASYNC);
//
// P0 Linkstatus and Link Active LED
//
GPIO_setPinConfig(GPIO_148_ESC_PHY0_LINKSTATUS);
GPIO_setPadConfig(148, GPIO_PIN_TYPE_STD);
GPIO_setPinConfig(GPIO_143_ESC_LED_LINK0_ACTIVE);
GPIO_setQualificationMode(143, GPIO_QUAL_ASYNC);
GPIO_setPadConfig(143, GPIO_PIN_TYPE_INVERT);
//
// P0+P1 MDIO CLK and Data
//
GPIO_setPinConfig(GPIO_152_ESC_MDIO_CLK);
GPIO_setPinConfig(GPIO_153_ESC_MDIO_DATA);
//
// P1 TX and RX DATA
//
GPIO_setPinConfig(GPIO_131_ESC_TX1_DATA0);
GPIO_setQualificationMode(131, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_132_ESC_TX1_DATA1);
GPIO_setQualificationMode(132, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_134_ESC_TX1_DATA2);
GPIO_setQualificationMode(134, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_135_ESC_TX1_DATA3);
GPIO_setQualificationMode(135, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_139_ESC_RX1_DATA0);
GPIO_setQualificationMode(139, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_140_ESC_RX1_DATA1);
GPIO_setQualificationMode(140, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_141_ESC_RX1_DATA2);
GPIO_setQualificationMode(141, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_142_ESC_RX1_DATA3);
GPIO_setQualificationMode(142, GPIO_QUAL_ASYNC);
//
// P1 TX Enable, RX DV, RX ERR
//
GPIO_setPinConfig(GPIO_129_ESC_TX1_ENA);
GPIO_setQualificationMode(129, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_136_ESC_RX1_DV);
GPIO_setQualificationMode(136, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_138_ESC_RX1_ERR);
GPIO_setPadConfig(138, GPIO_PIN_TYPE_STD);
//
// P1 TX and RX Clk
//
GPIO_setPinConfig(GPIO_130_ESC_TX1_CLK);
GPIO_setQualificationMode(130, GPIO_QUAL_ASYNC);
GPIO_setPinConfig(GPIO_137_ESC_RX1_CLK);
GPIO_setQualificationMode(137, GPIO_QUAL_ASYNC);
//
// P1 Linkstatus and Link Active LED
//
GPIO_setPinConfig(GPIO_149_ESC_PHY1_LINKSTATUS);
GPIO_setPadConfig(149, GPIO_PIN_TYPE_PULLUP);
GPIO_setPinConfig(GPIO_144_ESC_LED_LINK1_ACTIVE);
GPIO_setQualificationMode(144, GPIO_QUAL_ASYNC);
GPIO_setPadConfig(144, GPIO_PIN_TYPE_INVERT);
//
// Sync and Latch
//
// Note these GPIOs aren't required for EtherCAT
// operation and are configured here for demonstration,
// analysis, and debug purposes
//
GPIO_setPinConfig(GPIO_125_ESC_LATCH0);
GPIO_setPinConfig(GPIO_126_ESC_LATCH1);
GPIO_setPinConfig(GPIO_127_ESC_SYNC0);
GPIO_setPinConfig(GPIO_128_ESC_SYNC1);
GPIO_setDirectionMode(127, GPIO_DIR_MODE_OUT);
GPIO_setDirectionMode(128, GPIO_DIR_MODE_OUT);
//
// Allocate controlCARD LEDS to CM
//
GPIO_setDirectionMode(CCARD_ECAT_RUN_LED_GPIO, GPIO_DIR_MODE_OUT);
GPIO_setDirectionMode(CCARD_ECAT_ERR_LED_GPIO, GPIO_DIR_MODE_OUT);
GPIO_setMasterCore(CCARD_ECAT_RUN_LED_GPIO, GPIO_CORE_CM);
GPIO_setMasterCore(CCARD_ECAT_ERR_LED_GPIO, GPIO_CORE_CM);
GPIO_setDirectionMode(CCARD_LED_1_GPIO, GPIO_DIR_MODE_OUT);
GPIO_setDirectionMode(CCARD_LED_2_GPIO, GPIO_DIR_MODE_OUT);
GPIO_setMasterCore(CCARD_LED_1_GPIO, GPIO_CORE_CM);
GPIO_setMasterCore(CCARD_LED_2_GPIO, GPIO_CORE_CM);
}
//
// configureAndReleaseCMToWait - Configure CM clocks, set boot mode to wait,
// and release from reset
//
void
configureAndReleaseCMToWait(void)
{
//
// Configuring CM to run at 125MHz (AUX Raw = 500MHz)
//
SysCtl_setCMClk(SYSCTL_CMCLKOUT_DIV_4, SYSCTL_SOURCE_AUXPLL);
//
// Configure CM boot up configurations and boot mode as wait boot
//
IPC_setBootMode(IPC_CPU1_L_CM_R,
(BOOT_KEY | CM_BOOT_FREQ_125MHZ | BOOTMODE_BOOT_TO_WAIT));
//
// Set IPC flag (required for boot)
//
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG0);
//
// Release CM from reset
//
SysCtl_controlCMReset(SYSCTL_CORE_DEACTIVE);
}
//
// releaseCMToApplication - Set CM boot mode to Flash or RAM, then release from
// wait boot mode
//
void
releaseCMToApplication(void)
{
//
// Configure CM boot up configurations and boot mode
//
#ifdef _FLASH
IPC_setBootMode(IPC_CPU1_L_CM_R,
(BOOT_KEY | CM_BOOT_FREQ_125MHZ | BOOTMODE_BOOT_TO_FLASH));
#else
IPC_setBootMode(IPC_CPU1_L_CM_R,
(BOOT_KEY | CM_BOOT_FREQ_125MHZ | BOOTMODE_BOOT_TO_RAM));
#endif
//
// Set IPC flag (required for leaving wait boot mode)
//
IPC_setFlagLtoR(IPC_CPU1_L_CM_R, IPC_FLAG0);
}
//
// End of file
//
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cpu1_cia402_solution"
device="Generic C28xx Device"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu64 --define=ETHERCAT_STACK --define=RAM --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --entry_point code_start --stack_size=0x200 --heap_size=0x1000 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu64 --define=ETHERCAT_STACK --define=_FLASH --define=CPU1 --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --entry_point code_start --stack_size=0x200 --heap_size=0x1000 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cpu1_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cpu1_cia402.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cpu1_cia402.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cpu1_echoback_solution"
device="Generic C28xx Device"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=ETHERCAT_STACK --define=RAM --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=RAM --entry_point code_start --stack_size=0x200 --heap_size=0x200 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=ETHERCAT_STACK --define=_FLASH --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=_FLASH --entry_point code_start --stack_size=0x200 --heap_size=0x200 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cpu1_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cpu1_foe_download_solution"
device="Generic C28xx Device"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=ETHERCAT_STACK --define=RAM --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=RAM --entry_point code_start --stack_size=0x200 --heap_size=0x200 --rom_model" />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${EXAMPLE_ROOT} -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=ETHERCAT_STACK --define=_FLASH --define=CPU1 --diag_warning=225 --diag_suppress=10063 --diag_suppress=770 --display_error_number" linkerBuildOptions="--define=_FLASH --entry_point code_start --stack_size=0x200 --heap_size=0x200 --rom_model" />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cpu1_hal.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_RAM_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="ETHERCAT_ROOT/cmd/2838x_FLASH_lnk_ecat_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,33 @@
<projectSpec>
<project
name="f2838x_cpu1_pdi_hal_test_app"
device="Generic C28xx Device"
cgtVersion="22.6.0.LTS"
products="C2000WARE"
outputFormat="ELF"
launchWizard="False"
linkerCommandFile=""
>
<configuration name="RAM" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=DEBUG --define=RAM --define=CPU1 --define=PDI_HAL_TEST --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=RAM --entry_point code_start --stack_size=0x200 --heap_size=0x200 " />
<configuration name="FLASH" compilerBuildOptions="--opt_level=2 -I${PROJECT_ROOT}/device -I${C2000WARE_DLIB_ROOT}/f2838x/driverlib -I${C2000WARE_DEVICE_SUPPORT_ROOT}/f2838x/common/include -I${ETHERCAT_ROOT}/include -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 --define=DEBUG --define=_FLASH --define=CPU1 --define=PDI_HAL_TEST --diag_warning=225 --diag_suppress=10063 --display_error_number" linkerBuildOptions="--define=_FLASH --entry_point code_start --stack_size=0x200 --heap_size=0x200 " />
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../../device_support/" scope="project" />
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../../driverlib/" scope="project" />
<pathVariable name="ETHERCAT_ROOT" path="../../../" scope="project" />
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
<file action="copy" path="EXAMPLE_ROOT/pdi_test_app.c" targetDirectory="" />
<file action="copy" path="ETHERCAT_ROOT/source/ethercat_slave_cpu1_hal.c" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="RAM" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="FLASH" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="device" />
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="device" />
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="" />
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="device" excludeFromBuild="True" />
</project>
</projectSpec>
@@ -0,0 +1,105 @@
//###########################################################################
//
// FILE: pdi_test_app.c
//
// TITLE: EtherCAT PDI (Processor Data Interface) example for F2838x CPU1
//
// F2838x CPU1 PDI Interface Test App
//
// This example tests the F2838x CPU1 EtherCAT PDI and demonstrates usage of
// the EtherCAT CPU1 HAL drivers. The example should be run on a F2838x
// controlCARD.
//
// External Connections
// The controlCARD RJ45 port 0 is connected to PC running TwinCAT master
//
// Watch Variables
// ESC_escRegs (ESC stands for EtherCAT Slave Controller) data structure will
// be constantly updated to show the latest values of the specified ESC
// registers
//
//#############################################################################
// $TI Release: F2838x EtherCAT Software v2.02.00.00 $
// $Release Date: Tue Oct 29 00:56:49 IST 2024 $
// $Copyright:
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// Neither the name of Texas Instruments Incorporated nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// $
//#############################################################################
//
// Included Files
//
#include "ethercat_slave_cpu1_hal.h"
//
// Main
//
void main()
{
uint16_t initStatus;
//
// Initialize CPU1 and HAL interface
//
initStatus = ESC_initHW();
//
// Loop and signal error if initHW returns failure
//
if(initStatus == ESC_HW_INIT_FAIL)
{
while(1)
{
//
// Toggle Error
//
ESC_signalFail();
}
}
//
// Setup and perform PDI Test
//
ESC_setupPDITestInterface();
//
// Update local RAM with ESC register values for debugging
//
while(1)
{
ESC_debugUpdateESCRegLogs();
DEVICE_DELAY_US((uint32_t)(50000));
}
}
//
// End of File
//