Ok finally managed to build a dts using compatible='gpio-leds' for outputs
and I now have a 15Mhz output.

I'll investigate why when I try to use pru code compiled from C, the signal
has a weird shape on the scope but using asm, it's a regular one.

For inputs, I do not know yet if I should use compatible="gpio-keys" or
something else, I did not find anything related to this yet.



2014-09-24 13:17 GMT-04:00 Cedric Malitte <[email protected]>:

> Hi,
>
> so trying to get my things up and running, I wrote a program for the PRU
> in asm to toggle 2 pins and read 4.
>
> In C, I manage to manipulate them because I'm using GPIO.
> But in asm... I try to interact with r30 and r31, and nothing really
> happens...
>
> I"m with kernel 3.15.
>
> Could someone guide me ?
> I think I have to add a dts to declare pins and pinmux, but I feel a bit
> lost on this point.
>
> In case, this is my asm source
>
> #include "pru.h"
> #include "pru_macros.hp"
>
> .origin 0
> .entrypoint MAIN
>
>
> MAIN:
>
>  /* enable ocp wide accesses */
>
>  LBCO r0, CONST_PRUCFG, 4, 4
>  CLR r0, r0, 4
>  SBCO r0, CONST_PRUCFG, 4, 4
>
>  /* prepared pru to host shared memory */
>
>  MOV r0, 0x000000120
>  MOV r1, CTPPR_0
>  ST32 r0, r1
>
>  MOV r0, 0x00100000
>  MOV r1, CTPPR_1
>  ST32 r0, r1
>
>
>  MOV r10, 0
>  MOV r11, 0
>  MOV r12, 0
>  /* main */
> LOOP1:
> SET r30.t15  /* CLK high */
> MOV r10, r31.b0 /* Read in the data */
>
> QBBC CHKSENSOR2, r10.b0.t0 /* if r10.0, set r11.0 */
> SET r11, 0
> CHKSENSOR2:
> QBBC CHKSENSOR3, r10.b0.t1 /* if r10.1, set r11.15 */
> SET r11, 15
> CHKSENSOR3:
> QBBC CHKSENSOR4, r10.b0.t2 /* if r10.2, set r12.0 */
> SET r12, 0
> CHKSENSOR4:
> QBBC ENDCHECK, r10.b0.t3 /* if r10.3, set r12.15 */
> SET r12, 15
>
> ENDCHECK:
> CLR r30.t15 /* CLK low  */
> LSL r11, r11, 1
> LSL r12, r12, 1
> ADD r0, r0, 1
> JMP LOOP1
>  /* store results from r10,r11 into host memory */
>
>  SBCO r10, CONST_PRUSHAREDRAM, 0, 8
>
>  /* signal cpu we are done (never reached) */
>
>  MOV r31.b0, PRU0_ARM_INTERRUPT + 16
>  HALT
>
>
> Thanks,
>
> Cedric
>
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "BeagleBoard" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/beagleboard/DvlQWGZ5VEs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to