Post Go back to editing

ADRV9002 configuration EXT_FRONTEND signals in device-tree

Category: Software
Product Number: ADRV9002
Software Version: 2022_R2 Patch1 Firmware 0.22.27, Stream 0.7.10.0, API version: 68.10.1

Hi,

we have a problem with how to define signals to "adi, gpios" in kernel device-tree.

The following configuration does not work for us:

adi,gpios {
#address-cells = <1>;
#size-cells = <0>;
/*
gpio@0 {
reg = <ADRV9002_DGPIO_0>;
adi,signal = <ADRV9002_GPIO_SIGNAL_ORX_ENABLE_1>;
};

gpio@1 {
reg = <ADRV9002_DGPIO_1>;
adi,signal = <ADRV9002_GPIO_SIGNAL_ORX_ENABLE_2>;
};*/

gpio@2 {
reg = <ADRV9002_AGPIO_00>; //Gpio number. Mandatory property in this node.
adi,signal = <ADRV9002_GPIO_SIGNAL_TX1_EXT_FRONTEND_CONTROL>; //Defines the function of this gpio. Valid range from 0 to 19. Mandatory property in this node.
adi,polarity = <0>; //Polarity of the GPIO pin (normal or inverted). 0 - normal, 1 - inverted
adi,master = <2>; //Whether BBIC or ADRV9001 controls this pin. 0 - BBIC, 2 - ADRV9002
};
gpio@3{
reg = <ADRV9002_AGPIO_08>; //Gpio number. Mandatory property in this node.
adi,signal = <ADRV9001_GPIO_SIGNAL_TX2_EXT_FRONTEND_CONTROL>; //Defines the function of this gpio. Valid range from 0 to 19. Mandatory property in this node.
adi,polarity = <0>; //Polarity of the GPIO pin (normal or inverted). 0 - normal, 1 - inverted
adi,master = <2>; //Whether BBIC or ADRV9001 controls this pin. 0 - BBIC, 2 - ADRV9002
};

gpio@4{
reg = <ADRV9002_AGPIO_01>; //Gpio number. Mandatory property in this node.
adi,signal = <ADRV9001_GPIO_SIGNAL_RX1_EXT_FRONTEND_CONTROL>; //Defines the function of this gpio. Valid range from 0 to 19. Mandatory property in this node.
adi,polarity = <0>; //Polarity of the GPIO pin (normal or inverted). 0 - normal, 1 - inverted
adi,master = <2>; //Whether BBIC or ADRV9001 controls this pin. 0 - BBIC, 2 - ADRV9002
};
/*gpio@5{
reg = <ADRV9002_AGPIO_09>; //Gpio number. Mandatory property in this node.
adi,signal = <ADRV9001_GPIO_SIGNAL_RX2_EXT_FRONTEND_CONTROL>; //Defines the function of this gpio. Valid range from 0 to 19. Mandatory property in this node.
adi,polarity = <0>; //Polarity of the GPIO pin (normal or inverted). 0 - normal, 1 - inverted
adi,master = <2>; //Whether BBIC or ADRV9001 controls this pin. 0 - BBIC, 2 - ADRV9002
};*/
};

--
If we pull the signal TX1_EN it switches between primed and rf_enabled ensm mode correctly but nothing happens on agpio0 pin.

------
Next problem is gpio ADRV9002_AGPIO_09 is commented out in dts because of this error, we don't know why his settings don't work:
Even if I disconnect it from our LNA, initialization still fails.

Any idea?


Thanks, Tom

  • If we pull the signal TX1_EN it switches between primed and rf_enabled ensm mode correctly but nothing happens on agpio0 pin.

    That is odd. I'm not seeing anything wrong in DT. Can you do `#define DEBUG` before the first header #include to see if the correct things are passed on into the API. Let's first make sure there's nothing wrong in DT parsing. The only thing that comes to mind is some that this configurations might need to happen earlier in the initialization process.

    Next problem is gpio ADRV9002_AGPIO_09 is commented out in dts because of this error, we don't know why his settings don't work:
    Even if I disconnect it from our LNA, initialization still fails.

    What error?

    - Nuno Sá

  • Hi nsa, sorry the second part of the log is lost. Error:

    [   20.244690] adrv9002 spi0.1: Set dpgio: 17, signal: 21
    [   20.245760] adrv9002 spi0.1: Set dpgio: 25, signal: 22
    [   20.246814] adrv9002 spi0.1: Set dpgio: 18, signal: 23
    [   20.247867] adrv9002 spi0.1: Set dpgio: 26, signal: 24
    [   20.248926] adrv9002 spi0.1: [ERROR]: Error number  3 (0x00000003), Recovery action -101.In file drivers/iio/adc/navassa/devices/adrv9001/public/src/adi_adrv9001_arm.c, in function adi_adrv9001_arm_CmdStatus_Wait, in line  700, variable name device.Error message ArmCmdStatusWait() failed due to thrown ARM error. Is device in correct state for calling command?.
    [   20.280842] adrv9002 spi0.1: [ERROR]: Error number  32769 (0x00008001), Recovery action -2.In file drivers/iio/adc/navassa/devices/adrv9001/private/src/adrv9001_arm.c, in function adrv9001_ArmCmdErrorHandler, in line  2853, variable name mailboxErrCode.Error message Error occurred during a Firmware Mailbox GET transaction.Check the connection between ADRV9001 Evaluation card and FPGA Platform.
    [   20.315696] adrv9002 spi0.1: [ERROR]: Error number  32769 (0x00008001), Recovery action -2.In file drivers/iio/adc/navassa/devices/adrv9001/public/src/adi_adrv9001_gpio.c, in function adi_adrv9001_gpio_Configure, in line  479, variable name NULL.Error message Error occurred during a Firmware Mailbox GET transaction.Check the connection between ADRV9001 Evaluation card and FPGA Platform.
    [   20.349936] adrv9002 spi0.1: adrv9002_dgpio_config, 2713: failed with "Error occurred during a Firmware Mailbox GET transaction.Check the connection between ADRV9001 Evaluation card and FPGA Platform" (32769)
    [   20.369526] adrv9002: probe of spi0.1 failed with error -14
    I think that the device tree is correct, below is the log with the commented AGPIO9. a signal is assigned to each gpio:

    [   12.800126] adrv9002 spi0.1: Set dpgio: 17, signal: 21
    [   12.801195] adrv9002 spi0.1: Set dpgio: 25, signal: 22
    [   12.802248] adrv9002 spi0.1: Set dpgio: 18, signal: 23
    [   12.803306] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.803317] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.803329] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.803338] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.803347] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.803355] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.813689] adrv9002 spi0.1: RX: Got clk: 0, data: 0
    [   12.813699] adrv9002 spi0.1: TX: Got clk: 0, data: 0
    [   12.815745] adrv9002 spi0.1: adrv9002-phy Rev 12.0, Firmware 0.22.27,  Stream 0.7.10.0,  API version: 68.10.1 successfully initialized
    Thanks, Tom

  • Hi Tom,

    It seems the bindings header got out of sync with the API headers. Can you try the following changes?

    diff --git a/include/dt-bindings/iio/adc/adi,adrv9002.h b/include/dt-bindings/iio/adc/adi,adrv9002.h
    index 3f7668d8bc4f..0300b2433234 100644
    --- a/include/dt-bindings/iio/adc/adi,adrv9002.h
    +++ b/include/dt-bindings/iio/adc/adi,adrv9002.h
    @@ -41,16 +41,16 @@
     #define ADRV9002_GPIO_SIGNAL_ORX_ENABLE_1              0
     #define ADRV9002_GPIO_SIGNAL_ORX_ENABLE_2              1
     /* AGPIO Signals */
    -#define ADRV9002_GPIO_SIGNAL_TX1_EXT_FRONTEND_CONTROL  21
    -#define ADRV9001_GPIO_SIGNAL_TX2_EXT_FRONTEND_CONTROL  22
    -#define ADRV9001_GPIO_SIGNAL_RX1_EXT_FRONTEND_CONTROL  23
    -#define ADRV9001_GPIO_SIGNAL_RX2_EXT_FRONTEND_CONTROL  24
    -#define ADRV9001_GPIO_SIGNAL_EXT_PLL_1_LOCK            25
    -#define ADRV9001_GPIO_SIGNAL_EXT_PLL_2_LOCK            26
    -#define ADRV9001_GPIO_SIGNAL_EXT_PLL_1_CE              27
    -#define ADRV9001_GPIO_SIGNAL_EXT_PLL_2_CE              28
    -#define ADRV9001_GPIO_SIGNAL_RX_VCO_1_CE               29
    -#define ADRV9001_GPIO_SIGNAL_RX_VCO_2_CE               30
    +#define ADRV9002_GPIO_SIGNAL_TX1_EXT_FRONTEND_CONTROL  24
    +#define ADRV9001_GPIO_SIGNAL_TX2_EXT_FRONTEND_CONTROL  25
    +#define ADRV9001_GPIO_SIGNAL_RX1_EXT_FRONTEND_CONTROL  26
    +#define ADRV9001_GPIO_SIGNAL_RX2_EXT_FRONTEND_CONTROL  27
    +#define ADRV9001_GPIO_SIGNAL_EXT_PLL_1_LOCK            28
    +#define ADRV9001_GPIO_SIGNAL_EXT_PLL_2_LOCK            29
    +#define ADRV9001_GPIO_SIGNAL_EXT_PLL_1_CE              30
    +#define ADRV9001_GPIO_SIGNAL_EXT_PLL_2_CE              31
    +#define ADRV9001_GPIO_SIGNAL_RX_VCO_1_CE               32
    +#define ADRV9001_GPIO_SIGNAL_RX_VCO_2_CE               33
    

    Thanks!

    - Nuno Sá

  • Hi,

    Sorry for late reply i was on vacation.

    it works.but it's just not clear to me - is it wrong in analog-linux? I used this branch 2022_r2_p1 and in defines adi,adrv9002.h for example ADRV9002_GPIO_SIGNAL_TX1_EXT_FRONTEND_CONTROL 21.

    We use api API version: 68.10.1 where do we get the correct headers?

    [   12.821306] adrv9002 spi0.1: Set dpgio: 17, signal: 24
    [   12.822376] adrv9002 spi0.1: Set dpgio: 25, signal: 25
    [   12.823429] adrv9002 spi0.1: Set dpgio: 18, signal: 26
    [   12.824483] adrv9002 spi0.1: Set dpgio: 26, signal: 27
    [   12.825541] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.825551] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.825564] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.825572] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.825582] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.825590] adrv9002 spi0.1: adrv9002_bb_round_rate: Rate 25000000 Hz
    [   12.835923] adrv9002 spi0.1: RX: Got clk: 0, data: 0
    [   12.835933] adrv9002 spi0.1: TX: Got clk: 0, data: 0
    [   12.837983] adrv9002 spi0.1: adrv9002-phy Rev 12.0, Firmware 0.22.27,  Stream 0.7.10.0,  API version: 68.10.1 successfully initialized

  • Hi,

    Yes, it's a bug in the kernel. There's a driver API that we incorporate in the kernel and those defines were taken from there. In some update those values changed and it broke the DT bindings header. Maximum tomorrow, I'll open a PR fixing this issue.

    BTW, thanks for testing!

    - Nuno Sá