Radarcape:Devicetree

From Beast Wiki
Revision as of 07:59, 7 October 2013 by imported>Dl4mea (→‎Radarcape Devicetree Howto)
Jump to navigation Jump to search
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 1: 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";
            };
        };
    };
};
<source>

'''Step 2:''' Compile (on Beaglebone)<br />
<source lang="bash">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 4: 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