Syntax for dts file error. Trying to make an overlay for connecting to PRU R30 register

220 views
Skip to first unread message

Charles Kerr

unread,
Sep 14, 2019, 3:28:05 PM9/14/19
to BeagleBoard
I can't find my old post, so I apologize for any repeat post.

I am trying to allocate two pins (P8_12,P8_46) to PRU0 and PRU1.   So effectively mode 6 and mode 5.  I want to exclusively use these by the pru(s).  Still trying to understand this device tree overlay, but I found an example one and modified it. It gives a syntax error when ti toy to compile it (dtc).  After beating my head against the wall, I am hoping a second set of eyes will be helpful.  Any help one can give on the syntax error (and if the dts file won't accomplish what the desire for these pins).

/*
    * 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
    *
    *
    * Modified by Derek Molloy for the example on www.derekmolloy.ie
    * that maps GPIO pins for the example
    */

    /dts-v1/;
    /plugin/;

    /{
        compatible = "ti,beaglebone", "ti,beaglebone-black";
        part-number = "DIYBLIGHTS";
        version = "00A0";
        exclusive-use = "P8.12,P8.46"
        fragment@0 {
            target = <&am33xx_pinmux>;
            __overlay__ {
                pinctrl_test: DM_GPIO_Test_Pins {
                    pinctrl-single,pins = <
                        0x003 0x06  /* P8_12 GPIO:44 $PINS:12 MODE 6 -pru0 R30_14 */
                        0x0A4 0x05  /* P8_46 GPIO:71 $PINS:41 MODE 5 - pru1 R30_1 */
                    >;
                };
            };
        };

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


Again, thanks ahead for any hep one can offer!

Charles

TJF

unread,
Sep 15, 2019, 11:22:13 AM9/15/19
to BeagleBoard
Hi Charles!

Drop all that device tree stuff. Instead use the elegant way for pinmuxing: libpruio. Side effects: faster booting time, smaller memory footprint.

Find example code for pinmuxing, downloading and running PRU firmware at


In your case the following code will do the trick (note: single source, pinmuxing in your program code)

if (io->setPin(io, P8_12, 6)) {
        printf("P8_12 configuration failed (%s)\n", io->Errr); break;}

if (io->setPin(io, P8_46, 5)) {
        printf("P8_46 configuration failed (%s)\n", io->Errr); break;}

Regards

kerrb...@gmail.com

unread,
Sep 17, 2019, 8:53:54 AM9/17/19
to BeagleBoard
Ok, so I got it working, so will post in case others face the same issue.  First, the syntax issue was a missing ";" after the exclusive use tag.  Also, I had some references using the wrong labels.  What wold be great if a write up on the current use and sections of the device tree for the beaglebone black.  Right now one must be knowledgeable in all things (PRU assembly, mapping memory to a arm program to read/write, tools to build the PRU, how to activate it, and finally device tree).  Although I know the basic concept of the device tree, known what to put for the sections (PRUSS, am355x, etc) and the keywords are still very much a mystery.  Hard to be knowledgable in all things and keep it a hobby).  Luckily I didn't have to disable items (although the next project I will).  Anyway, this file appears to have worked:









   /dts-v1/;


    /plugin/;




    /{


        compatible = "ti,beaglebone", "ti,beaglebone-black";


        part-number = "DIYBLIGHTS";


        version = "00A0";


        exclusive-use = "P8.12,P8.46";


        fragment@0 {


            target = <&am33xx_pinmux>;


            __overlay__ {


                diyblights: pinmux_pru_pru_pins {


                    pinctrl-single,pins = <


                        0x30 0x06  /* P8_12 GPIO:44 $PINS:12 MODE 6 -pru0 R30_14 */


                        0xA4 0x05  /* P8_46 GPIO:71 $PINS:41 MODE 5 - pru1 R30_1 */


                    >;


                };


            };


        };




        fragment@1 {


            target = <&ocp>;


            __overlay__ {


                test_helper: helper {


                    compatible = "bone-pinmux-helper";


                    pinctrl-names = "default";


                    pinctrl-0 = <&diyblights>;


                    status = "okay";


                };


            };


        };


    };



Reply all
Reply to author
Forward
0 new messages