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.

PROCESSOR-SDK-AM335X: EtherCAT Slave communication fails

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3359, AMIC110, SYSBIOS, TLK110, TLK105L

Hello,

I have built the ethercat_slave_full_AM335x_arm project and flashed on the AM3359 Sitara ICE v2 board. The application is running fine when I connect the device to TwinCAT. I am able to connect and update the TxPDO & RxPDO data. 

But when I connect the same slave device(AM335x based) with EC engineer tool(for Acontis master stack), it is not able to detect the slave device. I get following log in EC Engineer: 

INF | 2017-07-10 19:06:36 | Network scan successful - 0 slaves found
INF | 2017-07-10 19:06:34 | Network scan successful - 0 slaves found
INF | 2017-07-10 19:06:30 | Network scan successful - 0 slaves found
INF | 2017-07-10 19:06:28 | Network scan successful - 0 slaves found

Do we need to do any configuration change for using the slave with Aontis master stack. I want to do this to test the EtherCAT® Master Reference Design where it is asked to generate the ENI file after scanning the network. But it is not able to scan. Reference: www.ti.com/.../tiduaf8a.pdf

regards

Mohit

  • The EtherCAT team have been notified. They will respond here.
  • Hi Mohit, is this happens only with this version of EtherCAT slave? is your EC Engineer tool able to find other slaves?

    Some time back I faced a similar issue, and it was interesting, if I was connected to TI's wifi scan worked ok, If I disabled wifi "Source Mac Address" was not populated and EC- engineer tool reported "0 slaves found".

    Acontis supports (back them) belived it could be related to having TwinCAT installed in the same PC. I would suggest you tried a diffirent PC if possible and if the issue continue, you can workaround it by adding manually the slaves, or you can contact acontis support.

    In case you want to debug the issue, below information on how to enable EC-Engineer log:

    - Please set the GuiDebugMessageLevel to “2” and the MasterDebugMessageLevel to “5”. You can do this in the User.username.xml file. Normally you can find it in C:\ProgramData\EC-Engineer\

    - This is from their User Manual.

    - These will write all calls in the Log-File. So you will be able to see what went wrong.

    Thank you,

    Paula

  • Hi Paula,
    I tried with a different Ethercat slave(non TI) and faced the same issue. The EC engineer is not able to detect any ethercat slave.
    I tested with a PC where TwinCAT is not installed and it has two network interface cards. The network interface card on which the ethercat slave is connected is used by EC engineer and it still replies with "Network scan successful - 0 slaves found".

    I enabled the logs as you said but I cannot make out much from these logs.

    DBG | 2017-07-14 18:13:58 | [GUI 000038] DeinitMaster() ret=EC_NOERROR
    DBG | 2017-07-14 18:13:57 | [GUI 000038] DeinitMaster()
    DBG | 2017-07-14 18:13:57 | [GUI 000037] UnregisterClient() ret=EC_NOERROR
    DBG | 2017-07-14 18:13:56 | [GUI 000037] UnregisterClient()
    DBG | 2017-07-14 18:13:56 | [GUI 000036] CoeSdoUpload() ret=EC_NOERROR
    DBG | 2017-07-14 18:13:56 | [GUI 000036] CoeSdoUpload(dwSlaveId=65536, wObIndex=0xF000, byObSubIndex=0, dwDataLen=14, dwFlags=0x01)
    DBG | 2017-07-14 18:13:56 | [GUI 000035] GetScanBusStatus(oSbStatus=[dwSlaveCount=0, eResultCode=SUCCESS]) ret=EC_NOERROR
    DBG | 2017-07-14 18:13:56 | [GUI 000035] GetScanBusStatus()
    DBG | 2017-07-14 18:13:56 | [Master] McSm: Finish order REQ_SB (Id=0), Result = 0x0)
    DBG | 2017-07-14 18:13:56 | [GUI 000034] OnNotification() ret=(none)
    INF | 2017-07-14 18:13:56 | Network scan successful - 0 slaves found
    DBG | 2017-07-14 18:13:56 | [GUI 000034] OnNotification(type=EInfo, code=SB_STATUS, errMsg='Bus scan successful - 0 slaves found')
    DBG | 2017-07-14 18:13:56 | [Master] Notify EC_NOTIFY_SB_STATUS (0x00000000, 0)
    DBG | 2017-07-14 18:13:56 | [Master] McSm: WAIT_SB -> SB_DONE (SB_DONE)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_busscan_automatic->ecbtsm_idle (ecbtsm_idle, 0x00000000)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_notify_application_done->ecbtsm_busscan_automatic (ecbtsm_busscan_automatic, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_notify_application_wait->ecbtsm_notify_application_done (ecbtsm_busscan_automatic, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_notify_application->ecbtsm_notify_application_wait (ecbtsm_busscan_automatic, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_collectinfo_done->ecbtsm_notify_application (ecbtsm_busscan_automatic, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine: Sub state machine returns 0x9811002D in ecbtsm_collectinfo_done
    DBG | 2017-07-14 18:13:56 | [Master] BTStateMachine ecbtsm_collectinfo_wait->ecbtsm_collectinfo_done (ecbtsm_busscan_automatic, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_done->ecbtsms_error (ecbtsms_error, 0x9811002D)
    DBG | 2017-07-14 18:13:56 | [Master] /* m_dwSlavesAtStart = 0, m_bLineBreakAtStart = 0, m_wSlavesCntOnMainAtStart = 0, m_wSlavesCntOnRedAtStart = 0 */
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_wait->ecbtsms_countslaves_done (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [GUI 000033] GetScanBusStatus(oSbStatus=[dwSlaveCount=0, eResultCode=BUSY]) ret=EC_NOERROR
    DBG | 2017-07-14 18:13:56 | [GUI 000033] GetScanBusStatus()
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_send->ecbtsms_countslaves_wait (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_done->ecbtsms_countslaves_send (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_wait->ecbtsms_countslaves_done (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_send->ecbtsms_countslaves_wait (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_done->ecbtsms_countslaves_send (ecbtsms_collectbusscan, 0x98110008)
    DBG | 2017-07-14 18:13:56 | [Master] BTSubStateMachine ecbtsms_countslaves_wait->ecbtsms_countslaves_done (ecbtsms_collectbusscan, 0x98110008)



    regards
    Mohit
  • Hi Mohit, did you try, as a workaround, to add the slaves manually? Also, please contact acontis support with EC-engineer logs as they can point it out quicker what could be wrong.

    thank you,

    Paula

  • Hi Paula,
    The issue of EC engineer was on the firewall which was blocking EtherCAT packets. But now I am seeing that the TI slave gives a warning that the lines are crossed. I have only one slave node directly connected to PC with EC-engineer. The same port in TI board works fine with TwinCAT.
    In fact when I try a different ethercat slave(non TI), then I don't observe this issue.

    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    WRN | 2017-07-18 17:39:51 | Line Crossed! At least one cable incorrectly connected (IN port and OUT port crossed)! Please open the 'Line Crossed Analyzer' to find the problem.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    INF | 2017-07-18 17:39:51 | All pending errors were solved.
    WRN | 2017-07-18 17:39:51 | Line Crossed! At least one cable incorrectly connected (IN port and OUT port crossed)! Topology cannot be determined.
    WRN | 2017-07-18 17:39:51 | Network configuration mismatch! Please open the 'Network Mismatch Analyzer' to find the problem.


    The cable is connected from PC to AM335x J1. In this connection, I am able to communicate using TwinCAT.
    But for Acontis EC-Engineer, I have to connect to AM335x J2. What is the difference and what shall be the correct connection?

    If I use AM335x J2, then it is detecting the slave device but it is still not going into OP state. It goes to Pre-OP state and shows error state as "Invalid Input Configuration"

    WRN | 2017-07-18 19:36:10 | Failed to change master state: ERROR: Slave error (ErrCode: 0x98110024)
    INF | 2017-07-18 19:36:10 | Master state change from 'Init' to 'Pre-Op'
    INF | 2017-07-18 19:36:07 | Master state change from 'Unknown' to 'Init'
    INF | 2017-07-18 19:36:07 | Network scan successful - 1 slaves found

    regards
    Mohit

  • Hi Mohit, Automatic cable detection should permit us to use auto-crossing (1:1) or cross-over cables. But just curious which type of cable are you using?. Did you open 'Network Mismatch Analyzer' as the message suggested?
    I will ask internally, if we can think in any difference between J1 and J2 in AM335x board.. but as far as I know they should behave the same..

    thank you,
    Paula
  • Hi Paula,
    I am using straight cable(1:1). The Line crossed analyzer does not show anything as I have only one node connected directly to master. One question you said that there is no difference between J1 and J2 in AM335x board, but in general the EtherCAT slave has one IN port (port0 of ESC) and (0 or 2) OUT ports. Can you tell me where do you configure these ports?
    I believe it is done in board_tlkphy.c and Board_tlkMDIXTask() has some hard coded PHY address. What is the purpose of this hard coding when in board_phy.c there are Enums for PHY addr?

    I am using PRU-ICSS-EtherCAT_Slave_01.00.02.01 version.

    regards
    Mohit
  • Mohit, I got some comments from a colleague.

    he thinks the hard coded PHY address in Board_tlkMDIXTask() should be updated to reflect actual PHY address as shown in board_phy.c.

    void Board_tlkMDIXTask(UArg a0, UArg a1)
    {


    phyNum[0] = 0; /* TODO Hard coded PHY address */
    phyNum[1] = 1;
    }

    One suggestion, would be to update “Link speed & duplex” of NIC in host from “auto negotiation” to “100Mbps full duplex” to see if there is any issue with auto-negotiation.

    As a reference, in latest PRU-ICSS-EtherCAT_Slave_01.00.03.01, it was added a new function (shown below) to address an auto-negotiation issue which was observed in AMIC110 ICEv2.

    void Board_phyAutoNegAdvConfigFD(uint32_t mdioBaseAddress, uint32_t phyAddr)
    {
    uint16_t regStatus = 0;

    CSL_MDIO_phyRegRead(mdioBaseAddress, phyAddr, PHY_AUTONEG_ADV_REG, &regStatus);

    regStatus |= PHY_ANAR_100FD;
    regStatus |= PHY_ANAR_100HD;
    regStatus |= PHY_ANAR_10FD;
    regStatus |= PHY_ANAR_10HD;

    CSL_MDIO_phyRegWrite(mdioBaseAddress, phyAddr, PHY_AUTONEG_ADV_REG, regStatus);
    }

    Thank you,
    Paula
  • Hi Paula,
    I tried the above steps but it didn't help.
    One more observation I wanted to share. When I connect the LAN cable to J1 on AM335x(which is the OUT port & gives line mismatch error) and scan the slave device, then I see the device is detected. After this if I connect the same LAN cable to J2 and again scan, then it detects slave device on J2 without error. So I am not sure why this behavior is there. Basically it should have detected the device in the very first trial with J2 port. But it seems it configures something after 1st detection and then even if I change the port it works.

    regards
    Mohit
  • Mohit, this behavior only happens with EC-Engineer? or with other masters? do you know if autonegotation is enabled in EC-Engineer?

    thank you,
    Paula
  • The behavior is same with TwinCAT. But with TwinCAT when I connect to J1 of AM335x, it enters to "OP LNK_MIS LNK_ADD A B" state with Actual state showing "OP". So in this case it is able to communicate with the slave device and I can see RxPDO/TxPDO getting changed. Later if I connect to J2 without turning OFF the board, I can communicate properly with state as "OP". So the problem is detecting the device in the first instance from J2 port. 

    The issue I have observed is with PDK(3_02_00_05) + PRU Industrial SW(PRU-ICSS-EtherCAT_Slave_01.00.02.01) package. If I use sysbios_ind_sdk_02.01.02.02, then it is working fine and J2 port itself detects the slave device. 

    Can you please tell me the compatible combination of PDK, CCS and PRU ICSS Industrial SW because I may have installed multiple versions of pdk and pru icss. I tried working with PRU-ICSS-EtherCAT_Slave_01.00.03.01, CCS 7.2 and Processor SDK RTOS 4_00_00_04, but here I get some build error on linker for board APIs. Then I tried PRU-ICSS-EtherCAT_Slave_01.00.03.01 with processor_sdk_rtos_am335x_3_03_00_04, but here also I am facing some issue with ethercat slave device getting detected. From logs I undersand that it is getting stuck at bsp_start_esc_isr() call. So I want to try a compatible combination on a fresh machine and check. 

    regards

    Mohit

  • Hi Mohit,

    From PRU-ICSS EtherCAT Slave 01.00.03.01  Release Notes System Requirements we have that it is required PSDK 3.3.0. Please let us know how you test goes in a clean environment.

    thank you,

    Paula 

  • Hello Paula,
    I tested the release of PRU-ICSS EtherCAT Slave 01.00.03.01 with correct psdk in a new machine. I found that the ethercat_slave_demo project is not working. When I do step-by-step execution with breakpoints then I find that it is entering in exception at the call of SPI_open() function in tiesc_soc.c file.
    Then I tried the ethercat_slave_full project and it works fine with correct IN port.

    Now I modified the psdk for my custom board and built the libraries. I found that the ethercat_slave_full application is failing at SPI_open() call same as with demo example. Can you please check why the demo project is not working even when I use the correct system releases? Also what can be the reason for SPI_open going into exception?
    Can you tell me how can I build the drv and board library with more debugging. I mean with earlier release of PRU-ICSS EtherCAT Slave 01.00.02.01 and processor_sdk_rtos_am335x_3_02_00_05 I could do the single step debugging inside the function Board_init() or SPI_init(). But now with this configuration I am not able to do that.

    Thanks
    Mohit
  • Hi Paula,
    After further debugging I found that the exception is happening during semaphore handling in SPI_open(). So I commented the semaphore handling part in SPI_open and built the pdk libraries again. With this I am not getting exception but still the ports are not working. Can you explain why this semaphore handling causing exception?

    One more question, we are using DP83438 instead of TLK110 in the custom board. What all things I need to update in sample application to take care of the PHY changes? I found about one change for enhanced link detection as it is present with TLK and not with DP. I have modified mdioParamsInit.enhancedlink_enable =TIESC_MDIO_RX_LINK_DISABLE; but still it is not working. Please suggest.

    regards
    Mohit
  • Hi Mohit, I have been out of office, just returning, let me take a look and come back to you soon.

    thank you,

    Paula

  • Mohit, have you tried PRU-ICSS EtherCAT Slave 01.00.03.01 on AM335x ICEv2 board? If so, are you facing the same semaphore handling in SPI_open() issue? and/or second port connectivity detection issue?
    Please let me know, in order to see if we can reproduce here with an ICEv2 EVM board.
    thank you,
    Paula
  • Hello Paula,
    The ethercat_slave_demo project gives semaphore issue in PRU-ICSS EtherCAT Slave 01.00.03.01 on AM335x ICEv2 board. So this part you can check. But my ethercat_slave_full project is working on AM335x ICEv2 board and I am continuing my development using this project.

    Now I have a custom board based on AM335x ICEv2. In custom board, we are using DP83848 instead of TLK110. I have done changes in the code based on other forums for this PHY but I am not sure if all the changes are taken care of. So I wanted to know what are the changes required to use DP83848. In the custom board, the slave device is not getting detected on port0(IN port) but it gets detected on OUT port by Twincat.

    How enhanced link detection is enabled with DP83848 PHY? I have modified mdioParamsInit.enhancedlink_enable =TIESC_MDIO_RX_LINK_DISABLE; but still it is not working. Please suggest if the above statement is correct for DP83848 and then how does the enhanced link detection done by DP83848?

    regards
    Mohit
  • Hi Mohit, I will involve one of my colleagues who is more familiar with DP838XX vs TLK11X. He sent me a .ppt with a summary (attached), it is not yet polished for being in TI.com, but it is a good summary of these two types of PHYs, and you might find some useful information there. In summary, Main take away from this presentation is, in case of connectivity issues, to check PRU MDIO registers (especially MDIOLINK and MDIOALIVE), and a explanation of Enhanced Link Detection.

    MDIO_PHY_AMIC110.pptx

    Note: I would suggest to open another E2E thread with your PHY questions as this one started with a different topic (EC-engineer communication issues with ICEv2 board), and it will be confusing for anyone who try to follow it and want to jump to help.

    Thank you,

    Paula

  • Thanks Paula for your support. As you suggested, I have posted a query related to PHY in another e2e thread (e2e.ti.com/.../617395).
    The ppt has details on TLK10x vs DP838XX. But it is still not clear for me on what configuration settings are required in DP chip to get Ethercat communication working. Hoping to find some answers from ethernet forum.

    Also with the evaluation board PR1_MII1_RXLINK is connected to (PRUETH1_SPEEDLED) LED_SPEED of TLK110 phy. But for DP83848 it is recommended to use LED_LINK. Can it have any effect?

    regards
    Mohit
  • Mohit, I got a comment from a colleague about a common issue enabling Enhanced Link Detection.

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    "Enhanced link detection pin is connected to PHY_LED1 and in the PHY configuration the LED1 is set to blink on activity. So whenever there is activity it will seem to SOC that the link is turning on and off.
    Be sure to update “LED_CFG_MODE1“ to “LED_CFG_MODE0” in file tiescphy_tlk105l.c"

    Board_phyLED1Config((((PRUICSS_HwAttrs *)(
    pruIcssHandle->hwAttrs))->prussMiiMdioRegBase), phy0addr, LED_CFG_MODE0);
    Board_phyLED1Config((((PRUICSS_HwAttrs *)(
    pruIcssHandle->hwAttrs))->prussMiiMdioRegBase), phy1addr, LED_CFG_MODE0);
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    No sure if above is your case, but please take a look.

    thank you,
    Paula