Post Go back to editing

Blink LED example AD9364-7020 with ADRV1CRR-BOB

Category: Software

HI all,

I'm using AD9361-7020 with ADRV1CRR-BOB and latest Kuiper Linux image. RF part with given setup works perfectly.

For my project i need to toogle one GPIO pin or LED from python or terminal. 

at /sys/class/leds I see 4 leds. If I change brightness from 0 to 255 nothing happens. Led pins at P2-4, P13 3 and 4 , P7-16 stays equal to zero.

What i'm doing wrong?

I use these descriptions/schematics

https://github.com/analogdevicesinc/hdl/blob/master/projects/adrv9364z7020/common/ccbob_constr.xdc

https://wiki.analog.com/_media/resources/eval/user-guides/pzsdr/carriers/02-039931-01-c2.pdf

  • I have the same problem: I understand that LED 1-3 on the BOB from ADRV9364-Z7020 are not wired and therefore cannot be operated from the SOM. I can see that by comparing these schematics, or constraint files:.
    wiki.analog.com/.../adrv9364-z7020_revd-1.pdf
    wiki.analog.com/.../02-039931-01-c2.pdf
    However, why manipulating the brightness of led0 does not light it up remains a mystery.

  • at xdc file i can see few GPIOS at P2 52 and P2 54.

    set_property -dict {PACKAGE_PIN V11 IOSTANDARD LVCMOS25} [get_ports gpio_bd[5]] ; ## (lb: none) U1,V11,IO_L21_13_JX2_P,JX2,67,IO_L21_13_JX2_P,P2,52
    set_property -dict {PACKAGE_PIN V10 IOSTANDARD LVCMOS25} [get_ports gpio_bd[6]] ; ## (lb: none) U1,V10,IO_L21_13_JX2_N,JX2,69,IO_L21_13_JX2_N,P2,54

    Which GPIO number to use for controlling it. BASE (906) + 67 for controlling P2_52?  

    Value 1 or 0 for gpio 973 gives  0 at  P2_52

  • My current understanding is that gpio_bd should be the pin number after the zynq-7000 series chip offset 906 and the 54 MIO pins, i.e. from 960.
    So if you want to access gpio_bd[5], 965 should be the pin number on linux, but I don't think this will work:
    If you look at the device tree for adrv9364-z7020, you will see led1 on gpio-965(i.e. 906+59), even though it is not wired in HDL.

    https://github.com/analogdevicesinc/linux/blob/master/arch/arm/boot/dts/zynq-adrv9364-z7020-bob.dts#L38


    It appears that the mistake is happening because the adrv9361-z7035's device tree is being appropriated as is.
    I think led0 is also assigned on the wrong number (inconsistent with the HDL) , and this is why the led0 doesn't work.

    In short, led0 is gpio_bd[3], so it should be designated 963 in the device tree, but it is not.
    I think we perhaps need to rewrite the device tree correctly so that it is consistent with the adrv9364-z7020 reference HDL.

    P.S. 

    By editing the device tree and fixing led0 to the correct number, I confirmed that led0 can be lit by "/sys/class/leds/led0:green# echo 1 > brightness".
    I think by removing the extra leds, buttons and switches from the device tree that are not wired in HDL, you can access the other gpio_bd as well.
    Conversely, if you wire them in the HDL (and, of course, if the device tree is consistent with the HDL), the buttons and switches will be usable.

  • hi 

    give me hint where can i find device tree files in linux system?

  • You can find it (devicetree.dtb) in your root folder of your SD card.

    To edit it, you need to decompile .dtb to .dts using device-tree-compiler.

    Then you can edit .dts as you need, compile it to .dtb, and store .dtb in root folder of SD card.

    You can see if GPIO is configured correctly in devicetree by looking at /sys/kernel/debug/gpio.

    My case;

    analog@analog:~ $ sudo cat /sys/kernel/debug/gpio
    gpiochip0: GPIOs 906-1023, parent: platform/e000a000.gpio, zynq_gpio:
     gpio-913 (                    |ulpi resetb         ) out lo
     gpio-915 (                    |enable              ) out hi ACTIVE LOW
     gpio-960 (                    |Left                ) in  lo IRQ
     gpio-961 (                    |Right               ) in  lo IRQ
     gpio-962 (                    |Up                  ) in  lo IRQ
     gpio-963 (                    |led0:green          ) out lo
     gpio-1005 (                    |sync                ) out lo
     gpio-1006 (                    |reset               ) out hi

  • This link is useful https://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/software/linux/zynq_2014r2

    if you want to compile dtb or kernel.

    And after modification of the dtb led0 works fine. Thanks for your help