Post Go back to editing

#adin3310 SES AddDevice error -1

Category: Software

Hello,

I am trying to configure the ADIN3310 Ethernet switch using the SPI interface. I built the **ses-example-app** through cross-compilation on my Ubuntu host system, targeting a custom board based on the Kria K26 SoM running PetaLinux.

After successfully building the application, I transferred the executable to the target board and attempted to run it with the following command:

sudo LD_LIBRARY_PATH=/home/petalinux/adin3310/deploy_libs ./ses-example-app -f example-eval-6310.xml -g /dev/gpiochip0:5 -p /dev/spidev3.0 -m sysrepo-glue-srv/modules/ -s 1 -i production -l

The application starts but fails during initialization with the following output:

Interface Information:
-- /dev/spidev3.0, /dev/spidev1.0

Board settings file is located at example-eval-6310.xml
Yang modules folder sysrepo-glue-srv/modules/
libyang[0]: Value "00" was not found in the dictionary.
libyang[1]: String "00" not freed from the dictionary, refcount 1
Device MAC: 00:E0:22:12:34:56
Init with device on: /dev/spidev3.0 ready_pin:/dev/gpiochip0:5 speed:16000000
SES AddDevice error -1

The failure occurs during the device initialization step (SES AddDevice error -1). SPI pin strapping is configured correctly, but no pulses are observed on Timer0. A dummy MAC address is used in the XML file. I am not sure whether this is related to SPI communication, GPIO configuration, device tree settings, or the libyang/sysrepo setup.

Could you please help identify what might be causing this issue and what I should check or modify to resolve it?

Thank you.

Thread Notes

  • Hi Kiranmaye,

    Thank you for writing to us. 

    As you mentioned, you are using the ADIN3310 (3‑port switch). However, when executing the application, the example-eval-6310.xml configuration file is being used, which is intended for the ADIN6310 (6‑port switch). Could you please confirm whether you have updated the example-eval-6310.xml file for use with the ADIN3310?

    Additionally, which driver version are you using? Are you using standard SPI or QSPI?

    When you mention that no pulse is observed on Timer 0, does this mean there is no pulse from the start, or do pulses stop after the failure occurs? Also, would it be possible for you to share an SPI trace capture?

    Regards,
    Himanshu


  • Yes, I have updated the XML file and will attach it for your review.

    I am using the standard SPI driver. Currently, I am not observing any pulses from the beginning. Additionally, during SPI trace capture, there is no activity on the CLK, MOSI, or MISO lines. It appears that no SPI transactions are being initiated, as the clock signal is also inactive, which typically indicates that no data transfer is taking place. 

    <!-- 6310 HARDWARE SETUP -->
    <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
                xmlns:sched="urn:ieee:std:802.1Q:yang:ieee802-dot1q-sched"
          xmlns:ses="urn:adi:ses">
      <interface>
        <name>P0</name>
        <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
        <ethernet xmlns="urn:ieee:std:802.3:yang:ieee802-ethernet-interface">
          <if-type xmlns="urn:adi:ses">rgmii</if-type>
          <phy-rx-delay-supported xmlns="urn:adi:ses">false</phy-rx-delay-supported>
          <phy-tx-delay-supported xmlns="urn:adi:ses">false</phy-tx-delay-supported>
          <phy-type xmlns="urn:adi:ses">unmanaged</phy-type>
          <clock-selection xmlns="urn:adi:ses">internal</clock-selection>
          <phy-address xmlns="urn:adi:ses">0</phy-address>
          <link-polarity xmlns="urn:adi:ses">active-low</link-polarity>
          <phy-pull-up-control xmlns="urn:adi:ses">internal</phy-pull-up-control>
          <duplex>full</duplex>
          <speed>1</speed>
        </ethernet>
      </interface>
    
      <interface>
        <name>P1</name>
        <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
        <ethernet xmlns="urn:ieee:std:802.3:yang:ieee802-ethernet-interface">
          <if-type xmlns="urn:adi:ses">rgmii</if-type>
          <phy-rx-delay-supported xmlns="urn:adi:ses">false</phy-rx-delay-supported>
          <phy-tx-delay-supported xmlns="urn:adi:ses">false</phy-tx-delay-supported>
          <phy-type xmlns="urn:adi:ses">adin1300</phy-type>
          <clock-selection xmlns="urn:adi:ses">internal</clock-selection>
          <phy-address xmlns="urn:adi:ses">1</phy-address>
          <link-polarity xmlns="urn:adi:ses">active-high</link-polarity>
          <phy-pull-up-control xmlns="urn:adi:ses">internal</phy-pull-up-control>
          <duplex>full</duplex>
          <speed>1</speed>
        </ethernet>
      </interface>
    
      <interface>
        <name>P2</name>
        <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
        <ethernet xmlns="urn:ieee:std:802.3:yang:ieee802-ethernet-interface">
          <if-type xmlns="urn:adi:ses">rgmii</if-type>
          <phy-rx-delay-supported xmlns="urn:adi:ses">false</phy-rx-delay-supported>
          <phy-tx-delay-supported xmlns="urn:adi:ses">false</phy-tx-delay-supported>
          <phy-type xmlns="urn:adi:ses">adin1300</phy-type>
          <clock-selection xmlns="urn:adi:ses">internal</clock-selection>
          <phy-address xmlns="urn:adi:ses">2</phy-address>
          <link-polarity xmlns="urn:adi:ses">active-high</link-polarity>
          <phy-pull-up-control xmlns="urn:adi:ses">internal</phy-pull-up-control>
          <duplex>full</duplex>
          <speed>1</speed>
        </ethernet>
      </interface>
    </interfaces> 
    
    
    <!-- HOST MAC ADDRESS SETUP -->
    <ses xmlns="urn:adi:ses">
      <host-setup>
      <smp-mac-address>00-E0-22-12-34-56</smp-mac-address>
      </host-setup>
    </ses>
    
    <!-- PRP/HSR REDUNDANCY DISABLED -->
    <iec62439 xmlns="urn:ietf:params:xml:ns:yang:iec62439">
      <lreInterfaceConfigTable>
        <lreInterfaceConfigEntry>
          <lreInterfaceConfigIndex>0</lreInterfaceConfigIndex>
          <lreNodeType>none</lreNodeType>
          <lreSwitchingEndNode>prpnode</lreSwitchingEndNode>
          <lreDupListResideMaxTime>26214</lreDupListResideMaxTime>
          <lreMacAddress>3C-18-A0-9C-86-C2</lreMacAddress>
        </lreInterfaceConfigEntry>
      </lreInterfaceConfigTable>
      <port-assignment xmlns="urn:adi:ses">
        <lrePortA xmlns="urn:adi:ses">P1</lrePortA>
        <lrePortB xmlns="urn:adi:ses">P2</lrePortB>
        <lreDanPortC xmlns="urn:adi:ses">P0</lreDanPortC>
        <!-- <redboxInterlinkPortC1 xmlns="urn:adi:ses">P3</redboxInterlinkPortC1>
        <redboxInterlinkPortC2 xmlns="urn:adi:ses">P4</redboxInterlinkPortC2>
        <redboxInterlinkPortC3 xmlns="urn:adi:ses">P5</redboxInterlinkPortC3> -->
        <redboxInterlinkPortC4 xmlns="urn:adi:ses">none</redboxInterlinkPortC4>
      </port-assignment>
    </iec62439>
    
    <!-- MRP REDUNDANCY MODE -->
    <mrp xmlns="urn:ietf:params:xml:ns:yang:iec62439-2">
      <mrpDomainTable>
        <mrpDomainEntry>
          <mrpDomainIndex>0</mrpDomainIndex>
          <mrpDomainID>FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF</mrpDomainID>
          <mrpOui>080006</mrpOui>
          <mrpDomainName>MRP</mrpDomainName>
          <mrpDomainAdminRole>client</mrpDomainAdminRole>
          <mrpDomainRingPort1>1</mrpDomainRingPort1>
          <mrpDomainRingPort2>2</mrpDomainRingPort2>
          <mrpDomainVlanId>4095</mrpDomainVlanId>
          <mrpDomainManagerPriority>0</mrpDomainManagerPriority>
          <mrpDomainMRMReactOnLinkChange>disabled</mrpDomainMRMReactOnLinkChange>
          <recovery-rate xmlns="urn:adi:ses">recovery500</recovery-rate>
          <mrpRPort1TxPriority xmlns="urn:adi:ses">7</mrpRPort1TxPriority>
          <mrpRPort2TxPriority xmlns="urn:adi:ses">7</mrpRPort2TxPriority>
        </mrpDomainEntry>
      </mrpDomainTable>
    </mrp>
    
    

  • Hi Kiranmaye,

    When you mention that there is no activity observed on the SPI lines, it suggests that the SPI porting layer may not be functioning correctly.

    To add some context around the ses-example-app: by default, this example application supports communication over both SPI and Ethernet interfaces. However, the user is required to implement the host-specific porting layer for these interfaces.
    As a reference, two SPI porting layer examples are provided as part of the driver suite:

    1. FTDI4222 dongle–based SPI porting layer
    2. SPIDEV–based porting layer (using the on‑board Raspberry Pi SPI interface)

    These reference implementations can be found at: adinx310_tsn_driver_libraryxxx/examples/ses-linux-port-srv/src/spi

    Have you modified the SPI porting layer to match your host hardware? Could you provide more details about the target host hardware and application details?

    Regards,
    Himanshu

  • Hi Kiranmaye,

    Apologies for the delayed response.


    I would like to add some additional information regarding switch configuration over SPI. In the switch configuration over SPI, the host must always act as the SPI master, while the switch operates as the SPI slave. Since the SPI porting layer has not been updated according to your host configuration, there may be a mismatch with the host SPI driver. You will need to modify the SPI porting layer to align with your host’s SPI configuration.

    Please note that the provided reference SPI driver is designed to work only with the Raspberry Pi on‑board SPI device or the FTDI dongle, as the porting layer is written specifically to match their SPI configurations.

    As you mentioned that no data is visible on the SPI lines, this is expected if the host is not transmitting any data over SPI, which again points to a porting layer mismatch.

    Additionally, could you please confirm the following:

    • Are you using a fresh ADIN3310 board? Do you observe the Timer0/INT signal going high approximately every 1.25 seconds, with a low pulse duration of about 2 ms?
    • What is your host strapping (S3) configuration?
    • Which host platform are you using? Please share more details about the host hardware.

    Kindly update the SPI porting layer according to your host hardware and try again. If you face any issues while updating the porting layer, please feel free to reach out to us for support.


    Regards,
    Himanshu
     

  • Hello,

    I have verified that the SPI interface on my board is functioning correctly. To confirm this, I successfully configured another component (AD9361) using SPI, which indicates that the SPI on the board is operational.

    Regarding Timer0, I observe that the signal goes high approximately every 1.25 seconds, with a low pulse duration of around 2 ms.

    The host strapping configuration also appears to be correct, as it is set for SPI strapping.

    For context, my host hardware is a custom board incorporating the Kria K26 SoM. The ADIN3310 chip is interfaced via SPI, and the operating system running on the system is PetaLinux.

    Can you also tell how do I change this SPI porting layer?

    Regards,
    Kiranmaye

  • Hi Kiranmaye,

    When you build the ses-example-app, it is built by default with the FTDI driver porting layer, and it is expected to work with an FTDI dongle.
    For reference, the FTDI porting layer driver is provided at the following path:
    \adinx310_tsn_driver_library\examples\ses-linux-port-srv\src\spi\SES_PORT_FT4222_interface.c

    This porting layer is responsible for initializing the FTDI SPI interface and for sending and receiving SPI packets. In this source file, the following functions are defined to handle SPI initialization and data transfer:

    • SES_PORT_SPI_Init
    • SES_PORT_SPI_Release
    • SES_PORT_SPI_SendMessage
    • SpiRead

    Please review these function definitions and make the necessary modifications to align them with your host SPI specifications.

    For your reference, I have attached an SPI capture showing the switch initialization over a single SPI interface: SPI Capture

    Let us know you are facing issues while updating the porting layer.


    Regards,
    Himanshu  

  • Hello,

    I have a question regarding the file SES_PORT_FT4222_interface.c.

    When building the ses-example-app, I used the flag DSPIDEV=ON with the following command:

    cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=toolchain-aarch64.cmake -DSPIDEV=ON -DCMAKE_BUILD_TYPE=Debug
    

    Based on this, my understanding is that the application should use the SPIDEV interface, specifically:

    adinx310_tsn_driver_library/examples/ses-linux-port-srv/src/spi/SES_PORT_SPIDEV_interface.c
    

    Since the DSPIDEV=ON flag is enabled, I expect the SPIDEV interface to be selected. Could you please confirm if my understanding is correct, or let me know if there are additional conditions that would cause the FT4222 interface to be used instead?

    Additionally, the SPI capture files you shared are in .bin format, and I am currently unable to view or analyze them. Could you please provide them in a readable format or suggest a way to interpret them?

    Regards,
    Kiranmaye

  • Hi Kiranmaye,

    Your understanding is correct. You have built the ses-example-app using the SPI dev porting layer, and it is expected to work with the Raspberry Pi’s on‑board SPI interface.

    In this setup, you have two options:

    • Modify the existing porting layer provided at adinx310_tsn_driver_library/examples/ses-linux-port-srv/src/spi/SES_PORT_SPIDEV_interface.c, or
    • Develop a custom porting layer tailored to your specific host hardware.

    The shared SPI capture can be viewed using the Saleae Logic application, which can be downloaded directly from the Saleae website.



    Regards,
    Himanshu

  • Hello,

    I am currently working on porting the SPI communication layer used for ADIN3310 from Raspberry Pi to the Kria K26 SoM.

    The existing implementation is based on Linux spidev for SPI communication and libgpiod for handling the interrupt line. The design includes:

    • SPI communication via /dev/spidevX.Y

    • A dedicated thread that polls a GPIO line (via libgpiod) to detect interrupts

    • Semaphore-based protection for SPI access

    • Support for standard, dual, and quad SPI modes

    While the overall architecture is portable, I would like guidance on adapting this implementation correctly for the K26 platform.

    Specifically, I have the following questions:

    1. SPI interface enablement

      • Is it recommended to continue using spidev on K26, or should a custom SPI driver be used for ADIN3310?

      • What are the required device tree changes to expose the SPI interface (e.g., /dev/spidevX.Y)?

    2. GPIO interrupt handling

      • Is libgpiod the preferred approach on K26 for handling GPIO-based interrupts?

      • Are there any specific considerations for configuring GPIO interrupts in the device tree (especially for polling vs edge-triggered interrupt handling)?

    3. SPI mode support

      • Does the K26 SPI controller support dual/quad SPI modes via spidev?

      • Are there any limitations or recommended alternatives for achieving higher throughput?

    4. Threading and interrupt model

      • The current implementation uses a polling loop (usleep(100)) to detect GPIO state changes.

      • Would you recommend switching to an event-driven mechanism (e.g., edge-triggered interrupts via libgpiod) on K26?

    5. PetaLinux / platform setup

      • Any specific kernel configuration or driver enablement required (e.g., spidev, GPIO character device)?

      • Any reference device tree examples for SPI + GPIO interrupt setup on K26?

    6. Performance considerations

      • Are there known constraints related to SPI latency or GPIO interrupt responsiveness on K26 that should be considered for ADIN3310 communication?

    If there are any reference designs, example implementations, or recommended best practices for SPI-based communication with ADIN3310 on Kria K26, that would be very helpful.

    Regards,
    Kiranmaye

Before You Switch


Switching languages will make ADI Explorer unavailable. Resume your session by switching back to English and reopening ADI Explorer.