how to reset PRU ?

116 views
Skip to first unread message

jmels...@gmail.com

unread,
May 14, 2019, 8:38:00 PM5/14/19
to BeagleBoard
I am using the pruss software to control a PRU program.  I have several test programs that do one part at a time.  Now, when I combined the parts, the PRU program is not completing properly.  After this happens, the PRU will not respond until I reboot the Bone.

Is there some way to halt and reset the PRU subsystem back to the idle state, so it can be reloaded and started?

I tried to make a "kill PRU" program by executing this at the end :

    prussdrv_pru_clear_event (PRU_EVTOUT_0, PRU0_ARM_INTERRUPT);
    /* Disable PRU and close memory mapping*/
    prussdrv_pru_disable (PRU_NUM);
    prussdrv_exit ();

But, it didn't seem to do anything.

Thanks for any hints,

Jon

Charles Steinkuehler

unread,
May 15, 2019, 7:56:04 AM5/15/19
to beagl...@googlegroups.com
Try: prussdrv_pru_reset()

--
Charles Steinkuehler
cha...@steinkuehler.net

TJF

unread,
May 15, 2019, 1:37:31 PM5/15/19
to BeagleBoard
Hi Jon!


Am Mittwoch, 15. Mai 2019 02:38:00 UTC+2 schrieb jmels...@gmail.com:
Is there some way to halt and reset the PRU subsystem back to the idle state, so it can be reloaded and started?

This is a bit confusing in libprussdrv. Both, prussdrv_pru_reset() and prussdrv_pru_disable() stop the PRU (= clear the ENABLE bit in the PRU CONTROL Register. But only prussdrv_pru_disable() sets the SOFT_RST_N bit (= performs the reset).

In any case the PRU will be stopped after one of the commands. prussdrv_pru_disable() will reset the program counter to 0 (zero), while after prussdrv_pru_reset() you can resume at the current position.

Regards

jmels...@gmail.com

unread,
May 15, 2019, 9:32:05 PM5/15/19
to BeagleBoard
OK, my mistake, I was doing the prussdrv_exec_program with a text string that did NOT point to a .bin file in that directory.

And, there are errors in my pru .p file that I am trying to debug.  But, when I run my c program that starts the pru program properly, I get some debug output the first time, but then something gets hung in some way.  Now, when I run the c program, I get "Bus error" when I reference the shared memory that has been mmap'ed to the PRU's data memories.

Is there a way to undo an mmap?  I thought terminating the arm program would take care of that.

Thanks for any suggestions,

Jon

jmels...@gmail.com

unread,
May 16, 2019, 3:10:20 PM5/16/19
to BeagleBoard
OK, this is pretty painful, to have to reboot after every test of the PRU program.  I'm not sure what actually is going wrong.
But, after testing the c program which does start and run the PRU program, the c program needs to be killed with ctrl/c, and then I get a Bus error when I try to run ANY program that reads or writes to the mmap'ed PRU data memory.

I have tried a number of combinations of prussdrv functions and other things to clear it, none of them worked other than a reboot.

Thanks for any suggestions.

Jon

jmels...@gmail.com

unread,
May 16, 2019, 9:52:21 PM5/16/19
to BeagleBoard
Well, I don't really understand what was going on.  I did have a number of bugs in the PRU code that was likely causing it to be in an endless loop.  I have fixed those bugs and now the c program can execute the PRU program fine.  Maybe if the PRU program is constantly accessing the data memory, it prevents something from releasing the ARM side of the mmap --  or something.

Jon
Reply all
Reply to author
Forward
0 new messages