Post Go back to editing

porting from STM32L4 to nrf52840

Category: Software
Product Number: ADIN1110
Software Version: adin1110 zerphyr 3.7.99

I am looking for information to help ease the porting of the STM32L4 driving the ADIN1110 to a nRF52840. Analog devices has already incorporated the secure_mqtt_sensor_actuator application within the Zephyr library. Having made that the base of my hardware I can compile a hex file that operates on the nrf52840 usb dongle. The hex operates the COM over USB and spits out a few messages, but the one that I would like to address is the <wrn> net_if: No default interface found! The main.c fills the variable net_if_get_default() with null. because  the array _net_if_list_start[0] equals _netif_list_end[0]. I need to configure the interface with the SPI of the nrf52840 usb dongle. I thought this might be possible with a device tree overlay, but thus far has not changed the warning message. Leveraging the Zephyr library in a best practices sort of manner seems to be deep within the internet and elusive, but given the copying of a sample application like the secure_mqtt_sensor_actuator the development steps might be to select an appropriate board, add a application.conf, add a hardware.overlay, and compile. Any help towards the solution of my problem would be greatly appreciated.

Cy

  • Given the following overlay for my hardware I can get a the following messages on the USB com port: 

    ---- Opened the serial port COM11 ----
    [00:00:00.332,672] <err> net_if: There is no network interface to work with!
    *** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    [00:00:00.333,038] <inf> app_device: Device leds is ready
    [00:00:00.333,038] <wrn> net_if: No default interface found!
    [00:00:00.333,068] <err> app_main: No network interface configure

    Problem: The SPI does not seem to be engaged or the ADIN1110 has not been configured properly, no network interface. I will spend some time investigating the ADIN1110 configuration pins at the datasheet, as well as engaging the SPI some where to confirm my setup at the nRF52840 dongle level.

    Question: Is there any glaring config, or overlay that has not been attended? 

    &spi0 {
        compatible = "nordic,nrf-spi";
        pinctrl-0 = <&spi0_default>;
        pinctrl-1 = <&spi0_sleep>;
        
        cs-gpios = <&gpio1 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
        status = "okay";
    
        adin1110: adin1110@0 {
            compatible = "adi,adin1110";
            reg = <0x0>;
            spi-max-frequency = <25000000>;
            int-gpios = <&gpio1 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
            reset-gpios = <&gpio1 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
            status = "okay";
            spi-oa;
            spi-oa-protection;
    
            port1 {
                local-mac-address = [ 00 E0 22 FE DA C8 ];
            };
            mdio {
                compatible = "adi,adin2111-mdio";
                #address-cells = <1>;
                #size-cells = <0>;
    
                ethernet-phy@1 {
                    reg = <0x1>;
                    compatible = "adi,adin2111-phy";
                };
            };
        };
    };
    
    &spi0_default{
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                <NRF_PSEL(SPIM_MISO, 0, 15)>;
        };
    };
    
    &spi0_sleep{
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                <NRF_PSEL(SPIM_MISO, 0, 15)>;
            low-power-enable;
        };
    };
    
    // &gpio0 {
    //     swpd_en: swpd_en {
    //         gpio-hog;
    //         gpios = <0 20 GPIO_ACTIVE_HIGH>;
    //     };
    // };
    // &gpio0 {
    //     ts_timer_msel: ts_timer_msel {
    //         gpio-hog;
    //         gpios = <0 24 GPIO_ACTIVE_HIGH>;
    //     };
    // };
    // &gpio0 {  
    //         tx2p4_en: tx2p4_en {
    //         gpio-hog;
    //         gpios = <0 22 GPIO_ACTIVE_HIGH>;
    //     };
    // };
    
    // &gpio1 {
    //     ts_capt: ts_capt {
    //         gpio-hog;
    //         gpios = <1 13 GPIO_ACTIVE_HIGH>;   
    //     };
    //     // INT_N and RESET_N are already defined in the adin1110 node
    //     // csn is already defined in the spi0 node
    // };

  • The proj.conf has been edited to engage the SPI as follows: 

    CONFIG_ETH_DRIVER=y
    CONFIG_NET_L2_ETHERNET=y
    CONFIG_NETWORKING=y

    CONFIG_SPI=y
    QUESTION: why would these not be inside the application's proj.conf as default?
    Now, building the application halts on account of the reg = <0x1>;  within the spi0 in the ethernet-phy@1. The overlay was taken from the eval_adin1110ebz. The complaint is the size of the register which it takes from the parent mdio, cell adress and size 1 and 0, but build request 12bytes. as one is 4 bytes but the parent somehow indicates 3 regsiters even though address and size of parent is 1? 
    QUESTION: Why would a carefully edited overlay working for the eval_adin1110ebz  not work to port to another set of hardware? 
  • Hi  

    To avoid duplication, I'm closing this thread as there is another one open for the same query. Please follow up there if you have any questions.

    Kind regards,

    Shazia 

  • Given that I have been able to cobble together an SPI communication from the nrf52840 to the ADIN1110 I see the following results: SPI MOSI writes a buffer: 0x00, 0x80, 0x01, 0x00, 0x00,0x00, 0x00, 0x00(visualized with scope) and receives data a creates a buffer on MISO: 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00( visulaized with scope) with the following voltages on the ADIN1110 (multimeter): 

    1 MOSI 0.00
    2 MISO 0.00
    3 0.00
    4 0.00
    5 3.21
    6 2.53
    7 0.51
    8 0.61
    9 0.61
    10 N.C.
    11 N.C.
    12 1.63
    13 1.64
    14 1.64
    15 1.63
    16 3.29
    17 3.29
    18 N.C.
    19 0.91
    20 0.95
    21 N.C.
    22 3.29
    23 1.09
    24 1.09
    25 IRQ 0.04
    26 TEST1 3.28
    27 N.C.
    28 N.C.
    29 CSN 0.00
    30 TS_TIMER/MS_SEL 0.00
    31 TX2P4_EN 0.01
    32 N.C
    33 SWPD_EN 2.22
    34 N.C
    35 3.29
    36 N.C.
    37 SPI_CFG1 3.19
    38 SCLK 3.18
    39 N.C.
    40 TS_CAPT 0.00

    Any help as to why I have not received a 0x283c91 would be greatly appreciated!

    Cy Drollinger