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.

[FAQ] AM69: TDA4VH How to check current PCIe LTSSM state?

Part Number: AM69
Other Parts Discussed in Thread: , TDA4VH, TDA4VL, AM68, DRA829, TDA4VM, DRA821

Tool/software:

I would like to print out the LTSSM state of PCIe to see if the PCIe link is in Detect state, L0 state, etc. How can we do this under Linux?

  • Below is a bash script made using SK-AM69 11.0 Linux SDK which continuously polls the LTSSM state. Copy the script into storage device of board and run with ./poll_ltssm_for_change.sh. By default it will poll the LTSSM of PCIe0 instance. Usage to change to different PCIe instance is in usage. 

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/poll_5F00_ltssm_5F00_for_5F00_change.sh

    Example logs for 4 different scenarios:

    1. Example log for AM69 PCIe0 instance, where connection to external clock generator for Refclk is disconnected intentionally on SK board by desoldering some resistors to create different clock configuration, and no device is connected.
    2. Example log for AM69 PCIe3 instance, with no board changes, and no device connected.
    3. Example log for AM69 PCIe3 instance, with no board changes, and device is connected. Script is ran after device is connected and initialized.
    4. Example log for AM69 PCIe3 instance, with no board changes, and device is disconnected while script is running.

    1. Example log for AM69 PCIe0 instance, where connection to external clock generator for Refclk is disconnected intentionally on SK board to create strange clock configuration, and no device is connected.
    
    root@am69a-sk:~# ./poll_ltssm_for_change.sh
    ############################################################
    Using default register address 0x02907014 for PCIe0 instance.
    
    DISCLAIMER: Bash script is not fast enough to poll all state changes.
    There will be some LTSSM states such as Configuration states that rarely get printed out, because the state change is too quick.
    
    Input PCIE_CORE_USER_CFG_USER_CFG_linkstatus register address
    if wanting to use different PCIe instance.
    
    Example for PCIe1 for TDA4VH: ./poll_ltssm_for_change.sh 0x02917014
    0x02927014 is PCIe2, and 0x02937014 is for PCIe3 instance.
    ############################################################
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    Value:0x1 State:Detect.Active
    Value:0x0 State:Detect.Quiet
    ^C
    
    
    2. Example log for AM69 PCIe3 instance, with no board changes, and no device connected.
    
    root@am69a-sk:~# ./poll_ltssm_for_change.sh 0x02937014
    Value:0x1 State:Detect.Active
    ^C
    
    
    3. Example log for AM69 PCIe3 instance, with no board changes, and device is connected. Script is ran after device is connected and initialized.
    
    root@am69a-sk:~# ./poll_ltssm_for_change.sh 0x02937014
    Value:0x10 State:L0
    ^C
    root@am69a-sk:~#
    
    
    4. Example log for AM69 PCIe3 instance, with no board changes, and device is disconnected while script is running.
    
    root@am69a-sk:~# ./poll_ltssm_for_change.sh 0x02937014
    Value:0x10 State:L0
    Value:0xb State:Recovery.RcvrLock
    Value:0x1 State:Detect.Active
    ^C
    
    

    Above will work for:

    • AM69/TDA4VH/J784S4
    • AM68/TDA4VL/J721S2 if ran with ./poll_ltssm_for_change.sh 0x02917014 - J721S2 only has PCIe1 instance and no PCIe0 or other instance
    • TDA4VM/J721E/DRA829
    • J7200/DRA821 if ran with ./poll_ltssm_for_change.sh 0x02917014 - J7200 only has PCIe1 instance and no PCIe0 or other PCIe instance
    • AM64 if ran with ./poll_ltssm_for_change.sh 0x0F100014 - AM64 has different offset address, but register value is same

    LTSSM encoding based off of DRA821 TRM Table 12-2468

    DISCLAIMER: bash script is not fast enough to print out all state changes. Especially the state changes between Detect and L0. When retraining is done using this FAQ, it will only sometimes capture the state changes: [FAQ] AM68, AM67, J722S, J721S2, J784S4, TDA4VM, TDA4VL, TDA4VH, DRA821: How to retrain PCIe link speed between Gen1 (2.5GT/s), Gen2 (5.0GT/s), and Gen3 (8.0GT/s) speeds . In any case, script is useful for basic troubleshooting to see if state is in L0 or still in Detect state.

    Regards,

    Takuma