Tool/software: Linux
Hi,
General purpose registers __R30 and __R31 are defined in pru header files and can be used for writing and reading I/O pins. If I want to write to GP R1. Can I use the following expression:
(*(volatile unsigned int *) 0x00024404) = 300;
-Based on global memory map on page 207 of TRM the PRU1 Debug register is located at: 0x0002_4400
-On page 283 register description provides 0x4 offset to get to GPREG1. That is how I came up with address 0x00024404.
My problem is that I don't get correct behavior. In my C code I use function start() defined in assembly file.
void main(void)
{
// (*(volatile unsigned int *) 0x00024404) = 300;
start();
}
//Assembly file:
.cdecls "perfTestContainer.c"
.clink
.global start
start:
;nop
LDI r1, 40 ; load the DELAY value into r1
MAINLOOP:
CLR r30.t5 ;
CLR r30.t5 ;
MOV r0, r1 ; l
DELAYOFF:
SUB r0, r0, 1 ;
QBNE DELAYOFF, r0, 0 ;
SET r30.t5 ;
MOV r0, r1 ;
DELAYON:
SUB r0, r0, 1 ;
QBNE DELAYON, r0, 0 ;
QBA MAINLOOP ;
END:
HALT ; halt the pru
If I write manually to r1 ( LDI r1, 40 ; load the DELAY value into r1) I get expected output. However, using (*(volatile unsigned int *) 0x00024404) doesn't work.
I didn't find that those registers are protected or require some special access. Did I miss anything?
Thanks in advance.
