Skip to content

Commit

Permalink
In SOME cases, the pru ram cannot be cleared until after the PRU has …
Browse files Browse the repository at this point in the history
…started.
  • Loading branch information
dkulp committed Oct 9, 2023
1 parent a3c7c98 commit 1ca81bc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/util/BBBPruUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <thread>
#include <unistd.h>

#include "../log.h"
#include "../common.h"
#include "../log.h"

#include "BBBPruUtils.h"

Expand Down Expand Up @@ -60,8 +60,9 @@ class PRUCoreInfo {
fprintf(rp, "stop");
fclose(rp);
}
} else {
controlRegs[0] = 1;
}
controlRegs[0] = 1;
}
void enable(uint32_t addr = 0) {
if (!hasUIO) {
Expand Down Expand Up @@ -173,9 +174,6 @@ static void initPrus() {
prus[1].instructionRam = base_memory_location + (AM33XX_PRU1IRAM_PHYS_BASE - AM33XX_PRU_BASE);
prus[1].instructionRamSize = 8 * 1024;

memset(prus[0].dataRam, 0, prus[0].dataRamSize);
memset(prus[1].dataRam, 0, prus[1].dataRamSize);
memset(prus[0].sharedRam, 0, prus[0].sharedRamSize);
memset(ddr_mem_loc, 0, ddr_sizeb);
__asm__ __volatile__("" ::
: "memory");
Expand Down Expand Up @@ -234,6 +232,10 @@ int BBBPru::run(const std::string& program) {
prus[pru_num].disable();
CopyFileContents(program, "/lib/firmware/am335x-pru" + std::to_string(pru_num) + "-fw");
prus[pru_num].enable();

memset(prus[pru_num].dataRam, 0, prus[pru_num].dataRamSize);
memset(prus[pru_num].dataRam, 0, prus[pru_num].dataRamSize);

return false;
}

Expand Down

0 comments on commit 1ca81bc

Please sign in to comment.