If your code appears like it might be running or it might not, someone else’s suggestion that the code is really loaded (when the pru is not in reset) is the right place to start. If the code appears to be loaded, my next troubleshooting tip is this:
The PRU has a “single step” mode in it, and it can be helpful. You access it through the CONTROL register, see section 4.5.4 under “Control Register.” In order to run your program you must have taken it out of reset by setting the ENABLE bit to 1. If instead you write both enable AND the SINGLE_STEP bits at the same time then the PRU should advance one instruction. You can look at the next register up (STATUS) and watch that PCOUNTER has moved.
I mentioned earlier that I wrote a script I found helpful for this sort of thing. It’s simple and obvious, but maybe I can save you the time of figuring it out by pasting it below. Save it as a file, and then use the shell import:
. pruAliases.sh
and it will make a bunch of aliases. I use bash; if you use something else, YMMV. There are aliases for looking at imem as well, at least the first few instructions.
For interested kibitzers, the base address here is for the AM335x … if you use something else this will likely be wrong.
Someone suggested playing some games with grep, etc. to clean up the devmem2 output. Good idea.
Guys I’m sorry I haven’t made much progress on my PRU debugger. I’ll try to spend some time on it this week to get it at least functional for displaying registers.
################### AM335x ###################
alias control0=“devmem2 0x4a322000 w”
alias status0=“devmem2 0x4a322004 w”
alias wakeup_en0=“devmem2 0x4a322008 w”
alias cycle0=“devmem2 0x4a32200C w”
alias stall0=“devmem2 0x4a322010 w”
alias r0-0=“devmem2 0x4a322400 w”
alias r1-0=“devmem2 0x4a322404 w”
alias r2-0=“devmem2 0x4a322408 w”
alias r3-0=“devmem2 0x4a32240C w”
alias r4-0=“devmem2 0x4a322410 w”
alias r30-0=“devmem2 0x4a322478 w”
alias r31-0=“devmem2 0x4a32247C w”
alias control1=“devmem2 0x4a324000 w”
alias status1=“devmem2 0x4a324004 w”
alias wakeup_en1=“devmem2 0x4a324008 w”
alias cycle1=“devmem2 0x4a32400C w”
alias stall1=“devmem2 0x4a324010 w”
alias r0-1=“devmem2 0x4a324400 w”
alias r1-1=“devmem2 0x4a324404 w”
alias r2-1=“devmem2 0x4a324408 w”
alias r3-1=“devmem2 0x4a32440C w”
alias r4-1=“devmem2 0x4a324410 w”
alias r30-1=“devmem2 0x4a324478 w”
alias r31-1=“devmem2 0x4a32447C w”
alias imem0="
devmem2 0x4a334000
devmem2 0x4a334004
devmem2 0x4a334008
devmem2 0x4a33400C
devmem2 0x4a334010
devmem2 0x4a334014
devmem2 0x4a334018
devmem2 0x4a33401C
"
alias dmem0="
devmem2 0x4a300000
devmem2 0x4a300004
devmem2 0x4a300008
devmem2 0x4a30000C
"
alias imem1="
devmem2 0x4a338000
devmem2 0x4a338004
devmem2 0x4a338008
devmem2 0x4a33800C
devmem2 0x4a338010
devmem2 0x4a338014
devmem2 0x4a338018
devmem2 0x4a33801C
"
alias dmem1="
devmem2 0x4a302000
devmem2 0x4a302004
devmem2 0x4a302008
devmem2 0x4a30200C
"