Radarcape:Devicetree: Difference between revisions

From Beast Wiki
Jump to navigation Jump to search
imported>Dl4mea
imported>Dl4mea
Line 240: Line 240:
6: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2<br />
6: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2<br />


On Beaglebone-Black it will show up like:<br />
On '''Beaglebone-Black''' it will show up like:<br />
root@rc301:~# SLOTS=$(find /sys/devices -name slots)
root@rc301:~# SLOTS=$(find /sys/devices -name slots)<br />
root@rc301:~# cat $SLOTS
root@rc301:~# cat $SLOTS
  0: 54:PF---
  0: 54:PF---
Line 253: Line 253:
  8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2
  8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2
  9: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-B-Radarcape
  9: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-B-Radarcape
Slot #5 and #6, both showing up with HDMI, are not indicated as '''L'''oaded.

Revision as of 09:35, 29 August 2014

For Experts The tasks described in this manual require expert knowledge of Unix/Linux and embedded systems.

This chapter describes how the Radarcape is attached into the Linux system of the Beaglebone. It is only informational, as this is already done on all Radarcapes provided to customers. You just need it if you bring up Linux from zero or want to learn how this step is done.

Device Tree Overlays

Step 0: Get the device tree compiler:

opkg install dtc

Device Tree Overlay for Beaglebone (white)

Step 1 - Beaglebone (white): Create ~/BB-W-Radarcape.dts:

/*  
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Purpose License Version 2 as
* published by the Free Software Foundation
*
* Original from: github.com/jadonk/validation-scripts/blob/master/test-capemgr/ 
*
* Modified by Guenter Koellner for the Radarcape
* using: UART5 handshake signals and some GPIOs             
* with a great thanks to Derek Molloy - http://derekmolloy.ie/beaglebone
*
* As on the Beaglebone Black pins beeing used are occupied by eMMC and HDMI,
* it will require a different setting (and obviously, a different cape hardware) 
*/

/dts-v1/;
/plugin/;

/{
    compatible = "ti,beaglebone";
    part-number = "radarcape";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
            
        __overlay__ {
            pinctrl_radarcape: radarcape_Pins {
                pinctrl-single,pins = <

                    /* GPIO Values: */
                    /* GPIO 0x07 Output         */
                    /* GPIO 0x27 Input pullup   */
                    /* GPIO 0x37 Input pulldown */
                    /* GPIO 0x2f Input no pull  */
                                                                     
                    /* Watchdog retrigger output */
                    0x078 0x07  /* P9_12 GPIO1_28 #60 Output Mode7 */            
 
                    /* GPS 1PPS Input */
                    0x040 0x37  /* P9_15 GPIO1_16 #48 Input  Mode7 pullup    PPS1 input */
                    
                    /* FPGA Pins */ 
                    0x018 0x37  /* P8_3  GPIO1_6  #38 Input  Mode7 pullup    CONF_DONE  */
                    0x01c 0x07  /* P8_4  GPIO1_7  #39 Output Mode7           DCLK       */
                    0x008 0x37  /* P8_5  GPIO1_2  #34 Input  Mode7 pullup    nStatus    */
                    0x030 0x07  /* P8_12 GPIO1_12 #44 Output Mode7           DATA0      */
                    0x014 0x07  /* P8_22 GPIO1_5  #37 Output Mode7           nCONF      */

                    /* UART5 CTS/RTS as addon to the default UART5 device tree settings */ 
                    0x0d8 0x36  /* P8_31 UART5_CTSN   Input  Mode6 pullup    CTS input  */
                    0x0dc 0x06  /* P8_32 UART5_RTSN   Output Mode6 no pull   RTS output */
                >;
            };
        };
    };

    fragment@1 {
        target = <&ocp>;
        __overlay__ {
            test_helper: helper {
                compatible = "bone-pinmux-helper";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_radarcape>;
                status = "okay";
            };
        };
    };
};


Step 1 - Beaglebone-Black: Create ~/BB-B-Radarcape.dts:

/*
 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Purpose License Version 2 as
 * published by the Free Software Foundation
 *
 * Original from: github.com/jadonk/validation-scripts/blob/master/test-capemgr/
 *
 * Modified by Guenter Koellner for the Radarcape
 * with a great thanks to Derek Molloy - http://derekmolloy.ie/beaglebone
 *
 * Beaglebone Black Version
 * requires Radarcape cape board version 3.0 or later
 *
 * compile using
 * dtc -O dtb -o BB-B-Radarcape-00A0.dtbo -b 0 -@ BB-B-Radarcape.dts
 */

/dts-v1/;
/plugin/;

/{
    compatible = "ti,beaglebone-black";
    part-number = "radarcape-v3";

    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;

        __overlay__ {
            pinctrl_radarcape: radarcape_Pins {
                pinctrl-single,pins = <

                    /* GPIO Values: */
                    /* GPIO 0x07 Output         */
                    /* GPIO 0x27 Input pullup   */
                    /* GPIO 0x37 Input pulldown */
                    /* GPIO 0x2f Input no pull  */

                    /* Watchdog retrigger output */
                    0x078 0x07  /* P9_12 GPIO1_28 #60 Output Mode7 */

                    /* GPS 1PPS Input */
                    0x040 0x37  /* P9_15 GPIO1_16 #48 Input  Mode7 pullup    PPS1 input */

                    /* FPGA Pins */
                    0x034 0x37  /* P8_11 GPIO1_13 #45 Input  Mode7 pullup    CONF_DONE  */
                    0x03c 0x07  /* P8_15 GPIO1_15 #47 Output Mode7           DCLK       */
                    0x038 0x37  /* P8_16 GPIO1_14 #46 Input  Mode7 pullup    nStatus    */
                    0x030 0x07  /* P8_12 GPIO1_12 #44 Output Mode7           DATA0      */
                    0x07c 0x07  /* P8_26 GPIO1_29 #61 Output Mode7           nCONF      */

                    /* UART5 CTS/RTS as addon to the default UART5 device tree settings */
                    0x0d8 0x36  /* P8_31 UART5_CTSN   Input  Mode6 pullup    CTS input  */
                    0x0dc 0x06  /* P8_32 UART5_RTSN   Output Mode6 no pull   RTS output */
                >;
            };
        };
    };

    fragment@1 {
        target = <&ocp>;
        __overlay__ {
            test_helper: helper {
                compatible = "bone-pinmux-helper";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_radarcape>;
                status = "okay";
            };
        };
    };
};

Device Tree Overlay Compilation and Installation

Step 2: Compile (on Beaglebone)

dtc -O dtb -o BB-W-Radarcape-00A0.dtbo -b 0 -@ BB-W-Radarcape.dts

Step 3: Copy to /lib/firmware

cp BB-W-Radarcape-00A0.dtbo /lib/firmware

Step 4b: Create a shortcut to the slots

export SLOTS=$(find /sys/devices -name slots)

Step 4b: Verify slots before appyling

cat $SLOTS

Must result in:
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—

Step 5: Apply the pinmux patches

echo BB-W-Radarcape > $SLOTS

Step 6: The dmesg command will inform you about what has been done (in case that you do that over serial console, you already will have seen this output)

dmesg -s 20

Must result in:
[ 31.862078] bone-capemgr bone_capemgr.8: part_number 'BB-W-Radarcape', version 'N/A'
[ 31.874269] bone-capemgr bone_capemgr.8: slot #4: generic override
[ 31.880473] bone-capemgr bone_capemgr.8: bone: Using override eeprom data at slot 4
[ 31.887937] bone-capemgr bone_capemgr.8: slot #4: 'Override Board Name,00A0,Override Manuf,BB-W-Radarcape'
[ 31.904636] bone-capemgr bone_capemgr.8: slot #4: Requesting part number/version based 'BB-W-Radarcape-00A0.dtbo
[ 31.926576] bone-capemgr bone_capemgr.8: slot #4: Requesting firmware 'BB-W-Radarcape-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
[ 31.952355] bone-capemgr bone_capemgr.8: slot #4: dtbo 'BB-W-Radarcape-00A0.dtbo' loaded; converting to live tree
[ 31.967771] bone-capemgr bone_capemgr.8: slot #4: #2 overlays
[ 31.983656] bone-capemgr bone_capemgr.8: slot #4: Applied #2 overlays.

Step 7: Verify if all is correct

cat $SLOTS

Must result in: 0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-W-Radarcape

Step 8: Apply the rest of the interfaces from standard device tree files

echo BB-UART5 > $SLOTS
echo BB-UART2 > $SLOTS

Step 9: verify if all is correct

cat $SLOTS

Must result in:
0: 54:PF—
1: 55:PF—
2: 56:PF—
3: 57:PF—
4: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-W-Radarcape
5: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART5
6: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2

On Beaglebone-Black it will show up like:
root@rc301:~# SLOTS=$(find /sys/devices -name slots)
root@rc301:~# cat $SLOTS

0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART5
8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART2
9: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-B-Radarcape

Slot #5 and #6, both showing up with HDMI, are not indicated as Loaded.