Part Number: AM4378
I am developing an application that uses both PRU-ICSS on an AM4378 processor. I am using TI CGT PRU 2.3.3 to compile my PRU firmwares.
On the ARM core, I run Linux with the custom PRU-ICSS driver. This driver enables the PRU-ICSS, enable the OCP masters, upload the PRU firmwares, starts the PRU cores, and communicates with the PRU firmware through the PRU-ICSS1 Shared RAM.
When I load/store 4 byte values in PRU-ICSS1 Shared RAM, everything works fine. But when I store values larger than 4 bytes by the PRU-ICSS0 cores the first 4 bytes are lost.
To deal with this problem in more detail, I made the following test firmware:
#include <stdint.h>
extern far uint8_t __PRU_CREG_BASE_PRU_SRAM;
void main()
{
uint8_t *dst = &__PRU_CREG_BASE_PRU_SRAM;
uint8_t tmp[16];
uint32_t i;
for (i = 0; i < 16; i++)
{
/* Fill temporary buffer with incremental sequence */
tmp[i] = i;
/* Fill Shared RAM with 0xff */
dst[i] = 0xff;
}
memcpy(dst, tmp, 16);
for (;;);
}
The program prepares a buffer of 16 bytes with an incrementing sequence and copies the contents of this buffer to the beginning of Shared RAM.
Then I read this data from Shared RAM from the ARM core by custom driver.
When this program is running on PRU-ICSS0 PRU0 I got: 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ff ff ff ff
When this program is running on PRU-ICSS1 PRU0 I got: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
I generated an assembler listing using dispru. They are the same for PRU-ICSS0 and PRU-ICSS1 except for the Shared RAM offset (0x50000 and 0x10000, respectively).
To copy memory, compiler generate these instructions:
LBBO & R14.b0, R0, 0, 16 SBBO & R14.b0, R1, 0, 16
Thus, the compiler generates the correct instructions. But these instructions are executed differently on PRU-ICSS0 and PRU-ICSS1.
What could be wrong? How can I fix this?