On 3/9/2014 8:37 PM, Manu wrote:
> I was trying a few days to enable PRU (BBB Ubuntu 12.04)  and run a input 
> testing code using the pin P9_24.
> 
> MUX = pin 97 (44e10984) 00000006 pinctrl-single  (SET to MODE 6)
> 
> P9 24 pr1_pru0_pru_r31_16.GPIO0_15: | MODE6 | INPUT
> 
> Nothing happens when I put the pin to 1.8 or GND

You have to enable the pin's input buffer:

https://github.com/cdsteinkuehler/beaglebone-universal-io/blob/master/cape-universal-00A0.dts#L429

> The ASM code is:
> 
> .origin 0
> .entrypoint START
> 
> #define PRU0_ARM_INTERRUPT 19
> #define AM33XX
> 
> #define GPIO1 0x4804c000
> #define GPIO_CLEARDATAOUT 0x190
> #define GPIO_SETDATAOUT 0x194
> 
> START:
> // clear that bit
>     LBCO r0, C4, 4, 4
>     CLR r0, r0, 4
>     SBCO r0, C4, 4, 4
> 
>     MOV r0, 1000000000 //# cycles
> 
> INPUTTEST:
>  
>  WBS r31.t15 //Wait til GPIO-15-in is high... P9_24
> SUB r0, r0, 1 //Subtract from counter
> QBNE INPUTTEST, r0, 0 //Loop if counter not at zero
>  // Send notification to Host for program completion
> MOV R31.b0, PRU0_ARM_INTERRUPT+16
> 
> MOV r0, 0
> HALT
> 
> I don't know what I am doing wrong and in Internet are not examples for 
> INPUT tests.

Your code looks OK.  Here's a known working example that uses the PRU
direct inputs to implement a PRU software based encoder interface:

https://github.com/cdsteinkuehler/linuxcnc/blob/WIP-pru-cleanup/src/hal/drivers/hal_pru_generic/pru_encoder.p

...it's not the easiest code to use as a reference, since it relies on
my universal overlay (to setup proper pin multiplexing), and ARM code
(to setup and configure the look-up tables to do counting, see encoder.c
in the same directory), but perhaps it will be of some help.

-- 
Charles Steinkuehler
char...@steinkuehler.net

-- 
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 beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to