Host Pru Synchronization

I thought I submitted this question but I can’t find it so maybe i didn’t hit post. If it is a duplicate, I apologize.

I am trying to figure out the pru and see how I would use it in my application. I am using the beta c libraries, which may be a problem.

All of the things I am doing I have made to work individually. I just can’t get them to all work together.

My goal here is to synchronize a set of commands to the pru.

The Pru code is:

for (i = 0; i < 3; i++){

waitForHost();

// " CLR R31, R31, 30 \n"
// " WBS R31, 30 \n"
// " CLR R31, R31, 30 \n"

readInstruction();
// perform task

notifyHost();

// " LDI R31.b0, PRU0_ARM_INTERRUPT + 16 \n"

}

the Host code is:

initializeApplication();

for (i = 0; i < 3; i++){
writeInstruction();

notifyPru();

// prussdrv_pru_send_event(ARM_PRU0_INTERRUPT);

waitForPru();

// prussdrv_pru_wait_event(PRU_EVTOUT_0);
// prussdrv_pru_clear_event(PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);

}

I added a write to shared memory location 0 for debug and when I run this once the pru gets the first notification
it does not stop at the waitForHost() at the top of the loop. The loop index is 2, never stopping at 0 or 1.

if I comment out the notifyPru(); call the pru waits and does not execute the loop.

I can either get it to not execute any passes or all of them at once.

Any light would be appreciated.