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.

TMS320F28P650DK: EtherCAT Slave Initialization

Part Number: TMS320F28P650DK
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

He ASM Team, 

posting on customer behalv: 

We are currently working with the evaluation board www.ti.com/.../LAUNCHXL-F28P65X, and we are observing - both with our own software and with TI’s example project (f28p65x_cpu1_echoback_solution) - that the EtherCAT core sporadically does not respond to accesses from the EtherCAT side after a reset from the external reset pin (everything else seems to work).

So far we have been able to narrow down the issue to the following: it occurs depending on the compiler optimization level used (it happens with -O4, but not with -O0). This suggests that the problem may be related to timing issue during the initialization of the registers.

Since the datasheets do not provide detailed information on this, I would like to ask whether there are more detailed requirements regarding the initialization phase, or whether this issue is known and if there is possibly a solution or workaround available.

 

Thank you for your support, 

Marinus 

  • Hi, Our expert on this topic is on leave. Please expect a delay.

  • Looking into it .Expect a delay.

  • We recommend to use -O2 optimization, as we have done our testing with -O2. Can you please test with -O2 optimization?

    This issue is likely due to compiler rearranging the order of commands in ECAT_init function in O4 optimization.

    Regards,
    Keshav

  • Even with -O2, which is the original setting of the project, I face the problem. It is more rare but still happens. Only with -O0 I am fine.

    Even if changing to -O2 would workaround the situation, I would like to have a solution that works regardless of the optimization settings.

    Regards, Stefan

  • Hi , 

    We need to make sure  ESC_initHW function should not be optimized . You can optimize other parts of code by setting optimization level 4. 

    You can refer this link how not to optimize the function : 28335 - Pragma for not optimizing a function away - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

    Can you please check this in your code and let us know.

  • Well, it works of course only to block ESC_initHW from being optimized.

    However, since the example code originally worked only for a specific pin configuration, we already adapted it to integrate properly with the SysConfig workflow.
    So now I have to set the individual optimization level to 0 for all functions related to it.

    As a workaround this is fine. Still, it only treats the symptoms, and I would prefer a clean solution where the underlying problem is properly identified and resolved.

  • Hi ,  can you tell us after what time is the issue occurring so we can try to reproduce it, also  can you share your code if possible. Also can you run the program in debug mode and  when the ethercat stops responding can you pause the program and let us know where the program is at that point. Right now we tried running example at O4 and and it is running fine.

  • Hi, no I can't tell you after what time it happens. Actually, it is reproducible for me with the original f28p65x_cpu1_echoback_solution example (so no need for our code). The original example is with -O2. With this setting it happens rarely. With -O4 it happens rather often.
    Maybe some words on the test seupt:
    I flash the example code.
    We are using a test software that integrates an Acontis EtherCAT master. 
    Every time a reset on the board is performed that software states "Slave removed from bus" and shortly afterwards "Slave added to bus".
    With the -O4 setting after a reset I often see (~30%) that the message "Slave added to bus is missing". Sniffing on the EtherCAT interface in that state, I observe, that the slave is not responding to requests on Al Status register (0x0130).
    That is why I assume that some timing issue in initializing the hardware registers is creating that problem.


  • Hi , we have understood the issue and able to reproduce . (Sometimes ethercat not getting detected after reset) . Currently we are occupied with some release work . Can you please give us some time while we look into it. We will get back by 25th Feb.

    Regards

    Kunal.

  • Hi Kunal,

    great that you are able to reproduce the problem. For the moment I can live with the workaround. It would be great if we can get a solution or detailed understanding what is causing the problem in March/April.

    Best regards,
    Stefan

  • Sure ,

    update (as of April) :

    Hi we are actively working on this issue , we have figured out when this case happens , we are checking with compiler team for further discussion . 

  • Hi sorry for the delay, 

    This  issue was caused due to clock synchronization , increasing the delay solved this issue.

    Can you please change the delay in file : C:\ti\c2000\C2000Ware_6_00_01_00\driverlib\f28p65x\driverlib\sysctl.h

    Regards

    Kunal.