Hi,

If you use PRU's "r30", then you need to mux your pin to "pruout" mode. The 
"gpio" mode is for the "classic" slow GPIOs that are accessed through the 
L3 bus.

I haven't tested, but you may want to try the following command:
 $ config-pin P9.28 pruout

Regards,
Dimitar

On Monday, February 27, 2017 at 1:03:27 AM UTC+2, Geoffrey Messier wrote:
>
> Hi everyone,
>
> I'm a beaglebone/PRU newbie and I'm stuck on getting a basic hello world 
> program up and running on the PRU.  My goal is to use load a simple PRU 
> assembly program to light an LED on the PRU development cape.  The light 
> corresponds to pin P9.28.  I'm using the uio_pruss kernel module.
>
> Rather than using an overlay, I'm opting to use config-pin since my 
> application will eventually require a fair bit of dynamic pin 
> reconfiguration.  I note in this post 
> <https://www.element14.com/community/community/designcenter/single-board-computers/next-gen_beaglebone//blog/2013/05/22/bbb--working-with-the-pru-icssprussv2>
>  that 
> the PRU is disabled in the default overlay.  Using the method suggested in 
> the post, I modify the default overlay I'm using 
> (am335x-boneblack-emmc-overlay.dtb) to change the status of the 
> pruss@4a300000 fragment from "disabled" to "okay".  To make sure that my 
> board is now using my modified overlay, I've also disabled the heartbeat 
> LED.  When I reboot, the heartbeat flash is gone and when I use dtc -I fs 
> /sys/firmware/devicetree/base to look at the current device tree, the 
> fragment is as follows:
>
>                pruss@4a300000 {
>                         compatible = "ti,pruss-v2";
>                         ti,pintc-offset = <0x20000>;
>                         ti,hwmods = "pruss";
>                         ti,deassert-hard-reset = "pruss", "pruss";
>                         status = "okay";
>                         interrupt-parent = <0x1>;
>                         interrupts = <0x14 0x15 0x16 0x17 0x18 0x19 0x1a 
> 0x1b>;
>                         phandle = <0xa5>;
>                         reg = <0x4a300000 0x80000>;
>                         linux,phandle = <0xa5>;
>                 };
>
>
> The cape seems to be working fine since "config-pin P9.28 hi" and 
> "config-pin P9.28 low" turns the LED on an off.
>
> My PRU assembly code, lighton.p, is:
> .origin 0 
> .entrypoint start 
>
> start:
> rept:
>         set r30.t3
>         jmp rept
>         halt
>
> and my app loader code, loader.c, is:
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <prussdrv.h>
> #include <pruss_intc_mapping.h>
>
> #define PRU_NUM 0 
>
> static int pru_cleanup(void) {
>    int rtn = 0;
>
>    if((rtn = prussdrv_pru_disable(PRU_NUM)) != 0) {
>       fprintf(stderr, "prussdrv_pru_disable() failed\n");
>       rtn = -1;
>    }
>
>    if((rtn = prussdrv_exit()) != 0) {
>       fprintf(stderr, "prussdrv_exit() failed\n");
>       rtn = -1;
>    }
>
>    return rtn;
> }
>
> int main(int argc, char **argv) {
>    int rtn;
>
>    if((rtn = prussdrv_init()) != 0) {
>       fprintf(stderr, "prussdrv_init() failed\n");
>       pru_cleanup();
>       return rtn;
>    }
>
>    if((rtn = prussdrv_open ( PRU_EVTOUT_0 )) != 0) {
>      fprintf(stderr,"prussdrv_open() failed\n");
>      pru_cleanup();
>      return rtn;
>    }
>
>    if((rtn = prussdrv_exec_program(PRU_NUM, "./lighton.bin")) < 0) {
>      fprintf(stderr, "prussdrv_exec_program() failed\n");
>      pru_cleanup();
>      return rtn;
>    }
>
>   getchar();  /* Pause to let the program execute. */
>
>   return pru_cleanup();
> }
>
> The following is a screen capture of what I'm doing to try and get all of 
> this to run:
> root@beaglebone:~/pru-helloworld# uname -r
> 4.9.11-bone4
> root@beaglebone:~/pru-helloworld# lsmod
> Module                  Size  Used by
> spidev                  7466  0 
> c_can_platform          6486  0 
> c_can                   9942  1 c_can_platform
> can_dev                12174  1 c_can
> pwm_tiehrpwm            4920  0 
> spi_omap2_mcspi        10167  0 
> pwm_tiecap              3801  0 
> tieqep                  7575  0 
> omap_aes               13012  0 
> omap_sham              21488  0 
> crypto_engine           5939  1 omap_aes
> uio_pruss               4928  0 
> omap_rng                4572  0 
> rng_core                7340  1 omap_rng
> evdev                  10035  1 
> tps65217_charger        4723  0 
> omap_wdt                4159  0 
> leds_gpio               3308  0 
> uio_pdrv_genirq         3437  0 
> uio                     8614  2 uio_pruss,uio_pdrv_genirq
> cpufreq_dt              4805  0 
> 8021q                  18006  0 
> garp                    5788  1 8021q
> mrp                     7092  1 8021q
> stp                     2117  1 garp
> llc                     5021  2 garp,stp
> cpufreq_powersave       1567  0 
> cpufreq_conservative     3649  0 
> root@beaglebone:~/pru-helloworld# ls /dev/ui*
> /dev/uinput  /dev/uio0  /dev/uio1  /dev/uio2  /dev/uio3  /dev/uio4 
>  /dev/uio5  /dev/uio6  /dev/uio7
> root@beaglebone:~/pru-helloworld# pasm -b lighton.p
>
> PRU Assembler Version 0.87
> Copyright (C) 2005-2013 by Texas Instruments Inc.
>
> Pass 2 : 0 Error(s), 0 Warning(s)
>
> Writing Code Image of 3 word(s)
> root@beaglebone:~/pru-helloworld# gcc -o loader -ggdb loader.c -lprussdrvd
> root@beaglebone:~/pru-helloworld# config-pin -q P9.28
> P9_28 Mode: gpio Direction: out Value: 0
> root@beaglebone:~/pru-helloworld# ./loader
> AM33XX
> File ./lighton.bin open passed
>
> root@beaglebone:~/pru-helloworld# 
>
> but the LED remains dark.
>
> Any suggestions would be greatly appreciated!  Thanks in advance for your 
> help and apologies in advance if this is something super obvious that I've 
> missed.
>
> Geoff
>
>
>
>
>
>
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/c4886944-00b3-4666-b3ac-0e88fc23afef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to