This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMS320F28379D: EtherCat

Part Number: TMS320F28379D
Other Parts Discussed in Thread: CONTROLSUITE

Tool/software: Code Composer Studio

I test EtherCat with ssc(v5.11), use SSCToolC28xPatch in TMDSECATCND379D_V1.0.

i test  with Controllcard(with EtherCat add on board)

i test EtherCat in Cia402 profile(in DC mode)

Run operation mode is works.

but current velocity and current position is not feedback.

i want use EtherCat in Cia402(Motion profile) with TMS320F28379D.

how to use?

  • Hello

    That EtherCAT solution currently doesn't support CIA402. If that is something you want to add, please get support from ETG.

    Best regards
    Chris
  • i find the cia402appl files(.c ,  .h) in the next folder 

    "C:\ti\controlSUITE\development_kits\TMDSECATCND379D_V1.0\SSCToolC28xPatch\Src"

    at the SSC tool

    DC_SUPPORTED  is check in the Synchronisation option and  CIA402_DEVICE is check in the Application option

    and creat new slave files 

    i find   "void CiA402_DummyMotionControl(TCiA402Axis *pCiA402Axis)" function  in the cia402appl.c

    i test cia402 application in simulation mode(Provided) withe TwinCat_ manager(v3.1) CSP mode, CSV mode

    i see DC_MODE(motion action) is running

    but i test Cia402 in the same methode with PIC24HJ128GP306(MICROCHIPS, SSC_supported)

    i find two platform is different

    PIC24HJ128GP306 is working well, but TMS32028F379D is working but not well enough

  • Did you modify the CiA402_DEVICE value in SSC tool? CiA402 is disabled by default in the SSC configuration file.
    This ESI and demo doesn't enable CiA402 since it isn't supported. This is something you'd have to add and test yourself.
    If you need support on getting CiA402 to work, post on the ETG forum.

    Best regards
    Chris
  • i tested ethercat sample code(in controll suit).
    The result is good 32bit data change is verry well good work.
    but Cia402 working is not good work
    i guesee data read/write is wrong...


    target position is running from 0 to 20
    actual position is o untill targetposition is 13.1072(0x20000)
    and when target position is over 13.1072, the actualposition is change 13.1072...

    i think Low word data is mask or not proper treat
  • Yes, that sounds like it could possibly be something with masking or word addressing of the device. I unfortunately can't support any further debug of this profile at this time. ETG will be your best resource for this.

    Best regards
    Chris
  • Sorry.

    I will give you another question.

    i find it is not EtherCat problem, but C compiler problem

    in Cia402appl.h file

    next statement

    /** \brief Data structure to handle the process data transmitted via 0x1600 (csp/csv RxPDO)*/
    typedef struct STRUCT_PACKED_START
    {
        UINT16 ObjControlWord; /**< \brief Control word (0x6040)*/
        INT32 ObjTargetPosition; /**< \brief Target position (0x607A)*/
        INT32 ObjTargetVelocity; /**< \brief Target velocity (0x60FF)*/
        INT16 ObjModesOfOperation; /**< \brief Mode of operation (0x6060)*/
    }STRUCT_PACKED_END
    TCiA402PDO1600;

    member is not equal type.

    So problem is occur

    Please check attached file.

    I think Structure alignment(1-word keyword or option)is need.

  • Hello

    You can try adjusting the struct so the two INT16s are next to each other. Additionally, refer to echoback solution and how it uses the pData pointer in the OutputMapping function to assign data.

    Best regards
    Chris
  • The first method of two methods you suggested
    It is an easy method to handle structure alignment.

    I have already reviewed the method
    There are a lot of things to fix in the source code
    Pending status.



    The second method is a little difficult to understand.
    Could you please explain more specifically?


    And I tried the following test.


    ecatappl.c file modify


    -->original
    void PDO_OutputMapping(void)
    {
    HW_EscReadIsr(((MEM_ADDR *)aPdOutputData), nEscAddrOutputData, nPdOutputSize );
    APPL_OutputMapping((UINT16*) aPdOutputData);
    }


    --> modified
    void PDO_OutputMapping(void)
    {
    HW_EscReadIsr(((MEM_ADDR *)aPdOutputData), nEscAddrOutputData, 1 );
    HW_EscReadIsr(((MEM_ADDR *)aPdOutputData+2), nEscAddrOutputData+2, nPdOutputSize-1 );
    APPL_OutputMapping((UINT16*) aPdOutputData);
    }


    Please refer to the attached file.
    It seems that the data has been stored at the desired address.

    But the situation that is stored in variables is strange.

    I guess ObjTargetPosition variable is 0x4E240001, but result is 0x00014E24(As you can see on the screen)

    and another question


    in cia402appl.c file
    void APPL_OutputMapping(UINT16* pData) function
    {
    .
    .

    LocalAxes[AxisIndex].Objects.objTargetPosition = SWAPDWORD(pOutputs->ObjTargetPosition);
    .
    .
    }

    LocalAxes[AxisIndex].Objects.objTargetPosition = 0x00014E24 is check


    pOutputs->ObjTargetPosition is eqaul to LocalAxes[AxisIndex].Objects.objTargetPosition


    SWAPDWORD keyword do not action

    Why?
  • The second method is how the F28379D solution grabs data. It uses the pData pointer to go word address by word address and place into variables how the data should be. Review the code and you'll see what I mean.

    I'm not sure I know what you asking regarding SWAPDWORD. I don't see any attachment.

    Best regards
    Chris
  • sorry 

    I have not solved the problem yet.

    i test another sample code 

    The sample code provided by controllsuit, EchoBack_Demo.

    As the guide suggests without modifying

    I followed.

    I have found the following situation.

    in coeapple.c 

    /*---------------------------------------------
    -    0x1C00
    -----------------------------------------------*/
    /**
     * \brief 0x1C00 (Sync manager type) object structure
     */
    typedef struct OBJ_STRUCT_PACKED_START {
       UINT16   u16SubIndex0; /**< \brief SubIndex 0*/
       UINT8   aEntries[4]; /**< \brief Entry buffer (one for each SyncManager)*/
    } OBJ_STRUCT_PACKED_END
    TOBJ1C00;
    /**
     * \brief 0x1C00 (Sync manager type) variable to handle the object data
     *
     * SI 0 : 4 (4 SyncManagers available)
     * SI1 (SM0): Mailbox Out (0x1)
     * SI2 (SM1): Mailbox In (0x2)
     * SI3 (SM2): Process data Out (0x3)
     * SI4 (SM3): Process data In (0x4)
     *
     */
    TOBJ1C00 sSyncmanagertype = {0x04, {0x01, 0x02, 0x03, 0x04}};

    /**
     * \brief 0x1C00 (Sync manager type) entry descriptions
     *
     * The object is an array so only the first entry is described (which is used for all entries).
     */
    OBJCONST TSDOINFOENTRYDESC    OBJMEM asEntryDesc0x1C00[2] = {
       {DEFTYPE_UNSIGNED8, 0x08, ACCESS_READ},
       {DEFTYPE_UNSIGNED8, 0x08, ACCESS_READ}};
    /**
     * \brief 0x1C00 (Sync manager type) object name
     */
    OBJCONST UCHAR OBJMEM aName0x1C00[] = "Sync manager type";
    working slave and Twincatmanager check data is next
    CoE-Online
    1C00           Sync manager type           RO      >4<
       1C00:01   Subindex 001                    RO      0x01(1)
       1C00:02   Subindex:002                    RO      0x00(0)
       1C00:03   Subindex 003                    RO      0x02(1)
       1C00:04   Subindex:004                    RO      0x00(0)
    This is not normal data.
    To get the right data, I think it should be
    1C00           Sync manager type           RO      >4<
       1C00:01   Subindex 001                    RO      0x01(1)
       1C00:02   Subindex:002                    RO      0x02(2)
       1C00:03   Subindex 003                    RO      0x03(3)
       1C00:04   Subindex:004                    RO      0x04(4)
    I think it is a situation that arises because of this reason.
    0x0001 -> 0x01, 0x00
    0x0002 -> 0x02, 0x00
    ...
    Is there a way to solve this problem?

  • That's correct, it shouldn't be like that. This comes back to the word addressing of the device.
    This is fixed in SSC v5.12. Generate those stack files and it will provide you the solution. Due to licensing and such, I can't post it here.

    Best regards
    Chris
  • CCS V8.3

    COMPILER   V18.3

    what problem?

    Continue?

  • The F28379D solution doesn't support SSC v5.12. It is built for v5.11. However there are several improvements in v5.12 regarding word addressing devices, so you can continue and refer to the code. For your development, you may want to use v5.12. I don't think you'll need a patch.

    Best regards
    Chris
  • http://file.inaom.co.kr/Customer.asp

    Play the mp4 ethercat connecting the slave.

    First : Axis add is occur problem

            maybe Et100  -> TMS320F28379D DATA COPY(especially  0x1600, 0x1601, 0x1602)

    Second    Object 0x1C00

    in SSCV512 make coeappl.c

    TOBJ1C00 sSyncmanagertype = {0x04, {0x0102, 0x0304}};

    So, The data(0x1c00) is displayed in twincatmanager as follows:

    1c00   syncmanager type

              Subindex  001                       2

              Subindex  002                      1

              Subindex  003                      4

              Subindex  004                     3

    i think  this is wrong

    i think proper data is next

    1c00   syncmanager type

              Subindex  001                    1

              Subindex  002                    2

              Subindex  003                   3

              Subindex  004                   4

    To display the above data

    TOBJ1C00 sSyncmanagertype = {0x04, {0x0201, 0x0403}};

    I think it should be corrected as above.   What is your opinion?

    Third  SSC V512 Padding

    SSCV512 modified that addes padding data.

    but  it is good but not proper location

    Here is a look at the code created by sscv12:

    typedef struct STRUCT_PACKED_START
    {
        UINT16 ObjControlWord; /**< \brief Control word (0x6040)*/
        INT32 ObjTargetPosition; /**< \brief Target position (0x607A)*/
    /*ECATCHANGE_START(V5.12) CiA402 3*/
        UINT16 Padding16Bit; /**< \brief 16bit padding*/
    /*ECATCHANGE_END(V5.12) CiA402 3*/
    }STRUCT_PACKED_END
    TCiA402PDO1601;

    I think it should be corrected as follows.

    typedef struct STRUCT_PACKED_START
    {
        UINT16 ObjControlWord; /**< \brief Control word (0x6040)*/

    /*ECATCHANGE_START(V5.12) CiA402 3*/
        UINT16 Padding16Bit; /**< \brief 16bit padding*/
    /*ECATCHANGE_END(V5.12) CiA402 3*/

        INT32 ObjTargetPosition; /**< \brief Target position (0x607A)*/
    }STRUCT_PACKED_END
    TCiA402PDO1601;

    I think these expressions have the right results.

    What is your opinion?

  • link file secret number is 1234

  • sorry correct number

    From left to right

    4386 1234
  • Yes, I agree with your edits to the stack.

    Best regards
    Chris
  • I do not seem to have the answer to the first question in the previous question.

    First : Axis add is occur problem

            maybe Et100  -> TMS320F28379D DATA COPY(especially  0x1600, 0x1601, 0x1602)

    I need an answer to this question.

    As soon as I tested it, it seems to be a memory bottleneck problem, including a memory alignment problem.

    Also,
    The ecat_def.h file has the following declaration:

    #define SIZEOF (x) (sizeof (x) * 2) IZEOF

    I wonder if this expression is really appropriate.

    As an example
    In the file cia402appl.c

    UINT16 CiA402_Init (void)
    {
             HMEMSET (& LocalAxes [AxisCnt], 0, SIZEOF (TCiA402Axis));


    }
    Among the phrases above

    If SIZEOF -> sizeof is modified, the two axes will be in "op" mode without error.
    However, the second axis has an istate value of 0x02 and is not active.

  • Another thing you can do is phone calls?
    If you can, please leave a phone number.
  • Hello

    E2E is the best place for me to support you.

    I am not clear what your first question is regarding the data copy. Please understand that we don't currently support CIA402, so please keep your questions specific to C28x functionality. We haven't gone through the process of what is needed to support CIA402.

    The EtherCAT stack expects sizes in bytes and SIZEOF() for C28x is in words therefore it has the multiple of 2.
    I can't commend on the behavior of it going to OP mode, please direct such questions to the ETG forums.

    Best regards
    Chris
  • My question is related to cia402.
    But I think it will be difficult to get help elsewhere.

    My question now seems to be organized into one thing.

    cia402appl.c file

    UINT16 CiA402_Init(void)

    {

    HMEMSET(&LocalAxes[AxisCnt],0,SIZEOF(TCiA402Axis));

    }

    As described above,

    The top two lines of data in the memory area of DefCiA402AxisObjDic are erased.

    but 

    HMEMSET(&LocalAxes[AxisCnt],0,(SIZEOF(TCiA402Axis)-30));

    As described above,

    The data of the top two lines in the memory area of DefCiA402AxisObjDic is preserved without being erased.

    in my opinion

    It seems to be invading the memory area(overwrite)

    0x0000DA00 LocalAxes
    0x0000DA00 0001 0001 0001 0000 0000 0001 0001 0000
    0x0000DA08 0000 0000 0000 0000 0006 0000 0010 6040 0010 0000 0020 607A 0020 60FF 0008 6060 0008 0000 0006 0000
    0x0000DA1C 0010 6041 0010 0000 0020 6064 0020 606C 0008 6061 0008 0000 0000 0000 0000 0002 0000 0001 0002 0000
    0x0000DA30 0000 0000 0000 0000 0000 0000 0000 0000 0002 0000 6C00 88CA 9400 7735 0000 0000 0002 0001 FFFD 0000
    0x0000DA44 0000 0000 0180 0000 C002 0000 0000 0001 0001 0000 0000 0001 0001 0000 0000 0000 0000 0000 0006 0000
    0x0000DA58 0010 6840 0010 0800 0020 687A 0020 68FF 0008 6860 0008 0800 0006 0000 0010 6841 0010 0800 0020 6864
    0x0000DA6C 0020 686C 0008 6861 0008 0800 0000 0000 0000 0002 0000 0001 0002 0000 0000 0000 0000 0000 0000 0000
    0x0000DA80 0000 0000 0002 0000 6C00 88CA 9400 7735 0000 0000 0002 0001 FFFD 0000 0000 0000 0000 0000 C34C 0000
    0x0000DA94 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DAA8 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DABC 0000 0000 0000 0000


    0x0000DAC0 DefCiA402AxisObjDic
    0x0000DAC0 0000 0000 0000 0000 1600 0021 0906 0000 D693 0000 D740 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DAD4 0000 0000 0000 0000 1A00 0021 0906 0000 D6A8 0000 D750 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DAE8 0000 0000 0000 0000 603F 0006 0700 0000 D85E 0000 D7F9 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DAFC 0000 0000 0000 0000 6040 0006 0700 0000 D861 0000 D7C8 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB10 0000 0000 0000 0000 6041 0006 0700 0000 D864 0000 D7ED 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB24 0000 0000 0000 0000 605A 0003 0700 0000 D867 0000 D5FB 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB38 0000 0000 0000 0000 605B 0003 0700 0000 D86A 0000 D669 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB4C 0000 0000 0000 0000 605C 0003 0700 0000 D86D 0000 D5A5 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB60 0000 0000 0000 0000 605E 0003 0700 0000 D870 0000 D6BD 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB74 0000 0000 0000 0000 6060 0002 0700 0000 D873 0000 D6F9 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB88 0000 0000 0000 0000 6061 0002 0700 0000 D876 0000 D5E0 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DB9C 0000 0000 0000 0000 6064 0004 0700 0000 D879 0000 D611 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DBB0 0000 0000 0000 0000 606C 0004 0700 0000 D87C 0000 D627 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DBC4 0000 0000 0000 0000 6077 0003 0700 0000 D87F 0000 D6D1 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DBD8 0000 0000 0000 0000 607D 0004 0802 0000 D80D 0000 D4B1 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DBEC 0000 0000 0000 0000 607A 0004 0700 0000 D882 0000 D760 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC00 0000 0000 0000 0000 6085 0007 0700 0000 D885 0000 D63D 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC14 0000 0000 0000 0000 60C2 002A 0902 0000 D816 0000 D46B 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC28 0000 0000 0000 0000 60FF 0004 0700 0000 D888 0000 D770 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC3C 0000 0000 0000 0000 6502 0007 0700 0000 D88B 0000 D653 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC50 0000 0000 0000 0000 FFFF 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
    0x0000DC64 CpuTimer1

  • From what you've provided, I would agree that it seems to be overwriting. Might want to trace through get what size it is computing and compare it to the data objects. Something seems to be misaligned or fed wrong information.

    Best regards
    Chris