Repository navigation
Conversation
PR Summary by QodoAdd PRU1 GPO4 to gpio_toggle examples and document them
AI Description
Merge Risk
|
bae9bb9 to
df083d5
Compare
|
/agentic_review |
df083d5 to
8cbb08e
Compare
Add a PRU1 GPO instance of the GPIO toggle, assembly and C examples. This allows toggle of both PRU0 and PRU 1 core pins simulataneously. Signed-off-by: Yashraj Motwani <y-motwani@ti.com>
8cbb08e to
157b0e4
Compare
|
/agentic_review |
157b0e4 to
d73def7
Compare
d73def7 to
aec1e4f
Compare
Add comments and documentation to the GPIO toggle assembly and C examples to make them easier to follow for users new to the PRU. - main.asm, main.c: describe what the example teaches and who loads the PRU, document the cycle count and expected frequency, and describe the three ways to change an output pin (overwrite, set/clear, XOR). - readme.md: document the PRU0 and PRU1 GPO4 pins, expected output, PRU clock and timing references, and debug steps. Signed-off-by: Yashraj Motwani <y-motwani@ti.com>
aec1e4f to
c210417
Compare
|
|
||
| Cores Tested for AM64x and AM243x: PRU0 and PRU1. | ||
| The default pinmux uses PRU0 GPO4. If the pinmux is modified to use PRU1 GPO4 on AM64x and AM243x, probe Pin 13 of the J4 header on the high speed expansion board instead of Pin 9 of the J2 header. | ||
| Cores Tested for AM64x and AM243x: PRU0 and PRU1. |
There was a problem hiding this comment.
are these lines actually needed? Seem to just be repeating info from before
| - BP.5 (J1/J3) for AM261-LP | ||
| - Pin 93 (J3 row B) for AM261-SOM | ||
| - To probe PRU0 GPO4, A13 (J2 Row A) on J2 Header, probe Pin 9 in J2 on TMDS64DC01 EVM (Expansion board) which is connected to the J2 header for AM64x and AM243x | ||
| - To probe PRU1 GPO4, B13 (J2 Row B) on J2 Header, probe Pin 13 in J4 on TMDS64DC01 EVM (Expansion board) which is connected to the J2 header for AM64x and AM243x |
There was a problem hiding this comment.
Don't re-list the EVM pin info if it's already handled above
| application asserts on most initialization failures (`Board_driversOpen()`, I/O expander, `PRUICSS_initMemory()`, `PRUICSS_loadFirmware()`). If it halts with an assert, the PRU is never | ||
| started. `Drivers_open()` and `PRUICSS_open()` return values are not | ||
| checked in this example. | ||
| 2. **Is the PRU running?** In CCS, connect to the PRU core (for example |
There was a problem hiding this comment.
Not a good test for if the PRU core is running, since you could randomly attach when the R30 happens to be at 0x10 several times in a row. Better options include the PRU cycle counter, watching the PC counter increment, etc.
| If the pin does not toggle, work through steps 1-4. Steps 5 and 6 are | ||
| firmware edits to try once the basic example works. | ||
|
|
||
| 1. **Is the R5F application running?** Open the UART console. The host |
There was a problem hiding this comment.
I think some of these steps are are generic debug which should probably live somewhere other than within a specific example. Thoughts on in the PRU Getting Started Labs > Lab 5: How to debug PRU firmware? Or somewhere else? https://dev.ti.com/tirex/explore/node?isTheia=false&node=A__ASFrNyRlBnGGirCwEz1a1Q__AM64-ACADEMY__WI1KRXP__LATEST
| different pins. See the Overview for which header pin belongs to which core. | ||
| 5. **Slow it down.** Set `DELAY_COUNT` in `main.asm` to `50000000`, which | ||
| gives a half period of about 0.5 s at 200 MHz. You can now see the | ||
| signal change on a multimeter or on an LED. |
There was a problem hiding this comment.
I like the multimeter suggestion
| * * Wait for the toggle delay before the next flip | ||
| * | ||
| * return: none (never returns) | ||
| * PEAK cycles per loop iteration: TOGGLE_DELAY_CYCLES + a few cycles |
There was a problem hiding this comment.
I don't like this. giving a vague "a few cycles" misses the point of giving cycles per loop. Ask me on Friday about the timing results for reading LBBO / LBCO from DMEM / SMEM
| * level of the first half period is unknown. */ | ||
| __R30 = 0; | ||
|
|
||
| /* Note: 0xFFFF_FFFF toggles all GPO pins */ |
There was a problem hiding this comment.
I wouldn't mind leaving the note "0xFFFF_FFFF toggles all GPO pins" in the comment above gpio = 0x10;
| /* Toggle GPO4 pin */ | ||
| gpio = 0x10; | ||
| /* Three ways to change an output pin. This example uses the third. | ||
| * 1. Overwrite: __R30 = 0x10; |
There was a problem hiding this comment.
Was this validated that it used LDI32 in the disassembly? (i.e., 32 bits overwritten?)
| Cores Tested for AM64x and AM243x: PRU0 and PRU1. Default: Enabled for PRU0. | ||
|
|
||
| The default pinmux uses PRU0 GPO4. If the pinmux is modified to use PRU1 GPO4 on AM64x and AM243x, probe Pin 13 of the J4 header on the high speed expansion board instead of Pin 9 of the J2 header. | ||
| Cores Tested for AM64x and AM243x: PRU0 and PRU1. |
There was a problem hiding this comment.
apply the same comments from gpio_toggle readme to gpio_toggle_c
| | gpio/gpio_toggle | Y | Y | Y | Y | N-sw | Y | | ||
| | gpio/gpio_toggle_c | Y | Yport | Yport | Yport | N-sw | Y | | ||
| | gpio/gpio_toggle | Y | Y | Y | Y | Yport | Y | | ||
| | gpio/gpio_toggle_c | Y | Yport | Yport | Yport | Yport | Y | |
There was a problem hiding this comment.
Yport for AM62x is correct, adding pinmuxing to Linux devicetree should be trivial for the next PR.
Let me know if you need any guidance on how to do that. (pinmux settings need to be associated with a devicetree node, because the pinmux settings don't get applied until the driver for a specific node is probed. So you can't just define a new pinmux section without referencing it from a devicetree node, since it won't actually get applied. The "cheat" is to just add the pinmux settings to an existing pinmux section (after making sure there are no pinmux conflicts), but there might be cleaner or "more correct" ways to do this)
Adding support for PRU0 and PRU1 cores enabled together for AM64x and AM243x. This toggles both the pins for the core. Updated the readme and main source files with detailed comments and debug steps to help new users.