Worked well with Beaglebone Black but can’t get the same code to work for BBAI64.
Just finished port to BBAI-64 and uploaded to GitHub - gitklindsayjr/Beaglebone_AI64: Repository for CCS and Eclipse Beaglebone AI-64
PRU application uses the BBAI-64, eQEP and GPIO0 periphereals, the PRU0 APWM and prg0_pru0_gpio for the Motor amp input and direction control.
I’ve had a little success using the PRU1 DRAM to share memory between PRU0 and the Linux side. From, the docs: PRU_ICSSG0_DRAM1_SLV_RAM has address 0x000B002000. (See J721E DRA829/TDA4VM Processors Silicon Revision 1.1 Texas Instruments Families of ProductsTechnical Reference Manual, p.135)
From the PRU0 side, I write into the memory with:
#define DRAM1ADDR 0x00002000
uint8_t volatile __far * const DRAM1 = (uint8_t*) DRAM1ADDR;
memcpy((void*) DRAM1, memtest, sizeof(memtest));
From the linux side, I read out of the memory with:
#define PRUDRAM1ADDR 0x000B002000
#define PRUDRAM1LEN 0x2000
unsigned int *dram1; // Points to start of PRU DRAM1
dram1 = mmap (0, PRUDRAM1LEN, PROT_READ | PROT_WRITE, MAP_SHARED, fd, PRUDRAM1ADDR);
Unfortunately, sometimes my PRU code just crashes when I try to start PRU0. I’m wondering if something is not set up properly in my device tree for PRU0. If I look at sudo cat /proc/iomem I don’t see anything allocated around 0x000B002000.
Any suggestions?
I have tried using PRU0 to PRU1 shared ram without any success. The memory is defined in the “J721E-PRU0_rscTbl.cmd” from the “pru-software-support-package” examples for the j721e. The cmd file defines:
PRU_SHAREDMEM : org = 0x00010000 len = 0x00010000 CREGISTER=28 I than added a SECTION as
.share_buff > PRU_SHAREDMEM, PAGE 2
This configuration works well on the BBB and not on the BBAI-64. I gave up on trying to find a solution. It is if I need to enable something in the PRU’s configuration.
Have you been able to share memory PRU0 to PRU1?
I haven’t tried sharing PRU0 to PRU1. I am just using PRU0 for now.
I have an old Linux app for the BeagleBone Black I think I will see if it still works. With Bullseye. The app uses the shared PRU memory at the defined addresses below.
#define PRU0_DATA_RAM 0x4a300000 // 8KB → 0x00000000
#define PRU1_DATA_RAM 0x4a302000 // 8KB → 0x00002000
#define PRU_SHARED_RAM0 0x4a310000 // 4KB → 0x00010000
#define PRU_SHARED_RAM1 0x4a311000 // 4KB → 0000011000
If it still works I will try to port it over to BBAI-64
Ran old app successfully to view the PRU_SHARED_RAM as sudo and as a member of the group “kmem”. The next step would to get the 2 PRU’s to talk to each other using the PRU_SHARED_MEM then I can try the same app on the BBAI-64. If anyone has any bright ideas on what to do to enable the PRU’s shared memory space. Also if their is a rule that can give “kmem” privileges to users who are members of that group.
I believe there is an example here on how to get both PRU’s to work together. I really don’t think there should be much more to it. They both write and read from memory. Building Blocks - Applications
With regards to the spec sheet, I believe you just have to adjust the memory locations from the sheet into the code, and it should work pretty much the same. I remember Jason Kreisler talking about the new Beaglebone AI-64, referring to the communication between the PRU’s and the linux workspaces, by reading and writing to memory locations. I myself have not tried this.