TMS320F28379D: CLA Debugging and MPC Out of Bounds

Part Number: TMS320F28379D

Tool/software:

Hello.



I am working on adapting some of single-core code for the f28379D into a multi-core design that utilizes the CLAs. I am currently debugging a CLA task that is triggered by the ISR (in CPU2) for ADC EoC interrupts.  


I am able to debug both my cores successfully, and I am using the steps mentioned here (CCS/TMS320F28377S: How to debug CLA code - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums) to debug my CLA code.

While the task seems to trigger (the first time)n correctly. Hitting resume on CCS does not cause the CLA to continue and let the task get re-triggered and run into a `mdebugstop`. Instead, it appears to just jump to the next instruction. This continues past the bounds of the task, as MPC keeps incrementing every cycle. I was wondering if there is a diagnosis for why this may be happening. 


I am initializing my CLA and tasks correctly (as far as I know) from CPU2 after CPU2 is woken up by CPU1 and does some checks on peripheral ownership (which I have verified to be correct).


Best,
Prakhar

  • HI Prakhar, 

    Can you confirm if you've followed the steps detailed in the debugging tips section in the CLA User's Guide:

     https://software-dl.ti.com/C2000/docs/cla_software_dev_guide/debugging.html 

    Regards,

    Ozino

  • Hi Ozino, Yes I have. 


    After debugging this some more. I am noticing a strange issue that may indicate it is an issue with my memory configuration.



    i have my memory configured as follows:

    - FLASH configuration
    - LS4 is data memory for CLA
    - LS5 is program memory for CLA
    I have verified that the variables and task code is getting loaded to the correct memory block in the debugger. The claprog is getting correctly copied from flash to ram.

    However, I was not configuring LSXRAM blocks using the API in memcfg.h. I now include the following instructions before I enable the CLA in the CPU2 subsystem

    ```
         // Configure Memory for the CLA
         {
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS2, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS3, MEMCFG_LSRAMCONTROLLER_CPU_ONLY);
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS4, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
              MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS5, MEMCFG_LSRAMCONTROLLER_CPU_CLA1);
             
         
              MemCfg_setCLAMemType(MEMCFG_SECT_LS4, MEMCFG_CLA_MEM_DATA);
              MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM); // --- Note---
         }

    ```


    This leads to my CLA attempting to execute code at 0x0B00 - which is right after LS5 - my CLA program memory ends.


    Removing the last line
    ```

              MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM); // --- Note---
    ```

    Seems to fix this problem, as the debugger now shows MPC in LS5. And I seem to be able to step through the task (somewhat) correctly. The variables in the task are not being written to (i am allocating scratchpad and cla bss in my linker script - being assigned to LS4 data memory). I suspect this is due to not configuring program memory correctly. 


    Let me know what further debugging steps I could do in order to pinpoint the problem
  • If this information helps - when I do run
    ```

              MemCfg_setCLAMemType(MEMCFG_SECT_LS5, MEMCFG_CLA_MEM_PROGRAM); // --- Note---
    ```

    I am able to view the LSxMSEL and LSxCLAPGM Registers. They appear to be set to 1 for MSEL_LS5 and CLAPGM_LS5, and 0 for the rest
  • I tried performing the memory configuration after enabling the CLA and its tasks (as opposed to doing it before) - and that seems to fix the issue. I wonder why that is the case.

  • Hi Prakhar,

    Glad to see you got it working.

    Please note that is the correct sequence to enable the CLA. You can check out this document that details how to enable the CLA in an existing example.

    /cfs-file/__key/communityserver-discussions-components-files/171/CLAProjectStructureUG.pdf

    The user's guide in the CLA describes the order in which the memory needs to be configured.

    Regards,

    Ozino