PRU Interrupt managing in Beaglebone Black

Hi,

I’m using a beaglebone black for my project and I would like to use the PRUs included into Sitara processor.

I’ve followed some "how to"s found on internet and in all of them there are examples employing PRU0, but not PRU1. I’ve have done some tuning in order to use PRU1, but I can’t make it works. My set up for using PRU with interrupt is the following:

For the C part:

`
#include “prussdrv.h”
#include <pruss_intc_mapping.h>
[…]
tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;
[…] prussdrv_open(PRU_EVTOUT_1);
[…] prussdrv_pruintc_init(&pruss_intc_initdata);
[…] prussdrv_exec_program (PRU_NUM, “./prucode.bin”);
prussdrv_pru_wait_event (PRU_EVTOUT_1); /* things… */ prussdrv_pru_clear_event(PRU_EVTOUT_1,PRU1_ARM_INTERRUPT);

`

While, in the assembly part i do:


#define PRU1 
#ifdef PRU0 
#define PRU_OFFSET 0x22000
#else
#define PRU_OFFSET 0x24000
#endif

// Refer to this mapping in the file - pruss_intc_mapping.h 
#define PRU0_PRU1_INTERRUPT 17
#define PRU1_PRU0_INTERRUPT 18
#define PRU0_ARM_INTERRUPT 19
#define PRU1_ARM_INTERRUPT 20
#define ARM_PRU0_INTERRUPT 21
#define ARM_PRU1_INTERRUPT 22
#define CONST_PRUCFG C4 
#define CONST_PRUDRAM C24 
#define CONST_PRUSHAREDRAM C28 
#define CONST_DDR C31 

// Address for the Constant table Block Index Register (CTBIR) 
#define CTBIR PRU_OFFSET+0x00020
// Address for the Constant table Programmable Pointer Register 0(CTPPR_0) 
#define CTPPR_0 PRU_OFFSET+0x00028
// Address for the Constant table Programmable Pointer Register 1(CTPPR_1)
#define CTPPR_1 PRU_OFFSET+0x0002C
// Enable OCP master port 
LBCO r0, CONST_PRUCFG, 4, 4
CLR r0, r0, 4
SBCO r0, CONST_PRUCFG, 4, 4

/* Configure the programmable pointer register for PRU0 by setting c28_pointer[15:0] field to 0x0120. This will make C28 point to 0x00012000 (PRU shared RAM).*/

MOV r0, 0x00000100
MOV r1, CTPPR_0 
ST32 r0, r1 CLOOP:
[...]
MOV r31.b0, PRU1_ARM_INTERRUPT +16
[...]
JMP CLOOP

My problem is that fuction prussdrv_pru_wait_event has not a blocking behavior. Or rather, program doesn’t wait on that function for the PRU instruction MOV r31.b0, PRU1_ARM_INTERRUPT +16.

Am I doing something wrong?

Use prudebug or some other pru debugger and step through your pru code. Maybe you are setting that interrupt.

You can also “cat /proc/interrupts” to view interrupt counts to see if it’s not blocking because your interrupt is firing. The pru interrupts will be there as pruss_evt0, evt1, etc.

-Brandon