From 058910d4de807665e90967645345e8805e03c35d Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Sun, 8 Oct 2023 17:29:45 -0400 Subject: [PATCH] In SOME cases, the pru ram cannot be cleared until after the PRU has started. --- src/util/BBBPruUtils.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/util/BBBPruUtils.cpp b/src/util/BBBPruUtils.cpp index e91ce9dbe..7f06e6d67 100644 --- a/src/util/BBBPruUtils.cpp +++ b/src/util/BBBPruUtils.cpp @@ -22,8 +22,8 @@ #include #include -#include "../log.h" #include "../common.h" +#include "../log.h" #include "BBBPruUtils.h" @@ -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) { @@ -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"); @@ -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; }