PRU and dts for IO definition in kernel 3.1x ?

59 views
Skip to first unread message

Cedric Malitte

unread,
Sep 24, 2014, 1:17:12 PM9/24/14
to beagl...@googlegroups.com
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

Cedric Malitte

unread,
Sep 24, 2014, 11:12:53 PM9/24/14
to beagl...@googlegroups.com
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.



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

Jon E

unread,
Sep 25, 2014, 8:01:23 AM9/25/14
to beagl...@googlegroups.com
Hi,

I have some simple examples of direct reading/writing under 3.8 (setting mode 6, exclusive use etc)..


Have the device tree definitions have changed for 3.1x? I've not yet successfully built my PRU code under the new 3.14 kernel, so perhaps bone-pinmux-helper is no longer an option?

Regards,
Jon

Cedric Malitte

unread,
Sep 25, 2014, 9:05:40 AM9/25/14
to beagl...@googlegroups.com
Hi Jon,

Yes under 3.1x some things have changed a bit for dts.
I failed with bone-pinmux-helper when I tried.

It's still a WIP for me and also a LIP ( learn in progress :) )

Regards,

Cedric

Robert Nelson

unread,
Sep 25, 2014, 9:21:58 AM9/25/14
to Beagle Board
On Thu, Sep 25, 2014 at 8:05 AM, Cedric Malitte
<cedric....@gmail.com> wrote:
> Hi Jon,
>
> Yes under 3.1x some things have changed a bit for dts.
> I failed with bone-pinmux-helper when I tried.
>
> It's still a WIP for me and also a LIP ( learn in progress :) )

The v3.14.x branch here: (1) uses pinmux-helper..

https://github.com/beagleboard/linux/tree/3.14

Regards,

--
Robert Nelson
http://www.rcn-ee.com/

Cedric Malitte

unread,
Sep 25, 2014, 1:02:14 PM9/25/14
to beagl...@googlegroups.com
Thanks Robert,
will check that.

Cedric 
Reply all
Reply to author
Forward
0 new messages