Wiki

This version (12 Jul 2019 17:56) was approved by rgetz.The Previously approved version (06 Aug 2018 08:56) is available.Diff

PlutoSDR/M2k boot magic explained

Custom u-boot environment variables

There are a set of custom u-boot environmental variables used during boot, which either are set dynamically by custom u-boot commands, or are imported from an additional protected u-boot environment or are part of the regular SPI u-boot environment but are used to control the runtime behavior.

Hardware Revision Handling

The PlutoSDR or M2k firmware (FIT image) supports multiple HW revisions. It’s being done reading a voltage divider which is unique for a given HW revision using the on chip XADC. This voltage is then mapped into 10 possible values which are then set in the fit_config environmental variable. Values are in the form of config@%d where %d is in the range from 0..9. This variable is then being used to load the corresponding FIT config which is right now only a dedicated device tree, however when necessary can be extended to also load a different bitfile.

The adi_hwref command will set fit_config and for Pluto Rev.A it will additionally set the PlutoRevA variable.

variable comment
fit_config config@ number
PlutoRevA set only for Rev.A

Device tree patching

During factory calibration the onboard TCXO reference frequency is measured and the actual reference clock frequency is stored in an additional protected SPI environment which is imported during boot. Later on this value is used to patch the device tree property clock-frequency in the /clocks/clock@0 path. This step can be skipped by the user when setting the ad936x_skip_ext_refclk variable. This allows for custom reference clock frequency set in the regular device tree.

variable device tree destination Comment
ad936x_ext_refclk /clocks/clock@0 clock-frequency Skip this by setting the ad936x_skip_ext_refclk variable
model /model Model string
attr_name /amba/spi@e0006000/ad9361-phy@0 ${attr_name} ${attr_val}
attr_val /amba/spi@e0006000/ad9361-phy@0 ${attr_name} ${attr_val}

Set during DFU update

The DFU altsetting of the DFU interface is stored in the dfu_alt_num variable and the transfers size is stored in the filesize variable.

variable comment
dfu_alt_num altsetting of the DFU interface in progress
filesize filesize of the transferred firmware image

Miscellaneous

variable comment
uboot-version u-boot version string set by the envversion command

Examples

What this means is to change any of these, log into your pluto sdr (over network or serial), and do this as root:

  • If you want to replace the 40 MHz oscillator, and insert a 10 MHz (10000000 Hz) clock:
    # fw_setenv ad936x_ext_refclk 10000000
  • If you have a AD9364 inside your PlutoSDR
    # fw_setenv attr_name compatible
    # fw_setenv attr_val ad9364
  • If you have a standard Zynq 7010 (not the special single core version)
    # fw_setenv maxcpus
  • If you want to tweak your default XO correction rather than 40 MHz, you have determined at a stable temp it is 39,999,764 Hz:
    # fw_setenv xo_correction 39999764
university/tools/pluto/devs/booting.txt · Last modified: 12 Jul 2019 17:56 by rgetz