This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379D: Processor load Simulink block functionality & RAM usage

Part Number: TMS320F28379D


Good afternoon,

I have searched the forum but haven't so far found any articles relating to measurement of processor load / task timing. If there are any, I would appreciate if you could steer me towards them.

I'm looking for a way to see how much my Simulink code is pushing the processor.

I have also looked in the Code output folder to see if there is a file that shows how much of the RAM is used. If anyone can help me find this, it would be excellent.

They are newbie questions but hopefully not too difficult to cross-reference with past posts (if I didn't find these)

Kindest regards

Chris

  • Hi Chris,

    Does this post answer what you are looking for in terms of measuring CPU task timing.

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/943879/faq-faq-how-do-i-use-simulink-custom-code-blocks-to-measure-code-execution-time-on-ti-c2000

    Regarding the memory usage - look for the linker MAP file. This should contain the memory usage.

    Ashwini

  • Thank you.

    I have been looking at the linker MAP file and would appreciate any advice on which hexadecimal memory addresses I can subtract to obtain a hexadecimal value of RAM memory used. I have inserted a screenshot of what appears when I search for 'ram'.

    Thank you for the link. I have been reading it but need a little more time to implement the steps in my model.

  • Hi Chris,

    The Linker Map file displays the section context with start address and length. So in the above snapshot the ramfuncs section length is 0x3b and it starts at address 0xA9358.

    If you are looking for a summary for total RAM usage then you can add the used number for each of the RAM regions at the top of the file in the memory configuration. Example:

    MEMORY CONFIGURATION

             name            origin    length      used     unused   attr    fill
    ----------------------  --------  ---------  --------  --------  ----  --------
    PAGE 0:
      RAMM0                 00000123   000002dd  00000000  000002dd  RWIX
      RAMLS0                00008000   00000800  00000135  000006cb  RWIX

    Used here is 0x0 + 0x135 = 0x135

    Thanks,

    Ashwini

  • Thank you very much Ashwini.

    I wanted to ask a few clarifications with regards to the content of the map file I have open. Could you help me identify the values that I should be adding up in this scenario? I would really appreciate it, so then I can document this in one of our internal guides. Thank you.

    for Page 0 I can see RAMLS_PROG used = 0000003b

    for Page 1 I can see RAMM0M1 used = 00000400

    RAMLS_DATA used = 0

    RAMD0D1 = 0

    RAMGS_DATA = 00006ef3

    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    BEGIN 00000000 00000002 00000000 00000002 RWIX
    RAMLS_PROG 00008000 00002000 0000003b 00001fc5 RWIX
    BEGIN_FLASH 00080000 00000002 00000002 00000000 RWIX
    FLASHA_N 00080002 0003fffe 0002b4be 00014b40 RWIX
    RESET 003fffc0 00000002 00000000 00000002 RWIX

    PAGE 1:
    BOOT_RSVD 00000002 00000120 00000000 00000120 RWIX
    RAMM0M1 00000122 000006de 00000400 000002de RWIX
    ADCA_RESULT 00000b00 00000020 00000018 00000008 RWIX
    ADCB_RESULT 00000b20 00000020 00000018 00000008 RWIX
    ADCC_RESULT 00000b40 00000020 00000018 00000008 RWIX
    ADCD_RESULT 00000b60 00000020 00000018 00000008 RWIX
    CPU_TIMER0 00000c00 00000008 00000008 00000000 RWIX
    CPU_TIMER1 00000c08 00000008 00000008 00000000 RWIX
    CPU_TIMER2 00000c10 00000008 00000008 00000000 RWIX
    PIE_CTRL 00000ce0 00000020 0000001a 00000006 RWIX
    PIE_VECT 00000d00 00000200 000001c0 00000040 RWIX
    DMA 00001000 00000200 000000e0 00000120 RWIX
    CLA1 00001400 00000040 0000003e 00000002 RWIX
    CLA1_MSGRAMLOW 00001480 00000080 00000000 00000080 RWIX
    CLA1_MSGRAMHIGH 00001500 00000080 00000000 00000080 RWIX
    EPWM1 00004000 00000100 00000100 00000000 RWIX
    EPWM2 00004100 00000100 00000100 00000000 RWIX
    EPWM3 00004200 00000100 00000100 00000000 RWIX
    EPWM4 00004300 00000100 00000100 00000000 RWIX
    EPWM5 00004400 00000100 00000100 00000000 RWIX
    EPWM6 00004500 00000100 00000100 00000000 RWIX
    EPWM7 00004600 00000100 00000100 00000000 RWIX
    EPWM8 00004700 00000100 00000100 00000000 RWIX
    EPWM9 00004800 00000100 00000100 00000000 RWIX
    EPWM10 00004900 00000100 00000100 00000000 RWIX
    EPWM11 00004a00 00000100 00000100 00000000 RWIX
    EPWM12 00004b00 00000100 00000100 00000000 RWIX
    ECAP1 00005000 00000020 00000020 00000000 RWIX
    ECAP2 00005020 00000020 00000020 00000000 RWIX
    ECAP3 00005040 00000020 00000020 00000000 RWIX
    ECAP4 00005060 00000020 00000020 00000000 RWIX
    ECAP5 00005080 00000020 00000020 00000000 RWIX
    ECAP6 000050a0 00000020 00000020 00000000 RWIX
    EQEP1 00005100 00000040 00000022 0000001e RWIX
    EQEP2 00005140 00000040 00000022 0000001e RWIX
    EQEP3 00005180 00000040 00000022 0000001e RWIX
    DACA 00005c00 00000010 00000008 00000008 RWIX
    DACB 00005c10 00000010 00000008 00000008 RWIX
    DACC 00005c20 00000010 00000008 00000008 RWIX
    CMPSS1 00005c80 00000020 00000020 00000000 RWIX
    CMPSS2 00005ca0 00000020 00000020 00000000 RWIX
    CMPSS3 00005cc0 00000020 00000020 00000000 RWIX
    CMPSS4 00005ce0 00000020 00000020 00000000 RWIX
    CMPSS5 00005d00 00000020 00000020 00000000 RWIX
    CMPSS6 00005d20 00000020 00000020 00000000 RWIX
    CMPSS7 00005d40 00000020 00000020 00000000 RWIX
    CMPSS8 00005d60 00000020 00000020 00000000 RWIX
    SDFM1 00005e00 00000080 00000080 00000000 RWIX
    SDFM2 00005e80 00000080 00000080 00000000 RWIX
    MCBSPA 00006000 00000040 00000024 0000001c RWIX
    MCBSPB 00006040 00000040 00000024 0000001c RWIX
    SPIA 00006100 00000010 00000010 00000000 RWIX
    SPIB 00006110 00000010 00000010 00000000 RWIX
    SPIC 00006120 00000010 00000010 00000000 RWIX
    SPID 00006130 00000010 00000000 00000010 RWIX
    UPP 00006200 00000100 00000048 000000b8 RWIX
    WD 00007000 00000040 0000002b 00000015 RWIX
    NMIINTRUPT 00007060 00000010 00000007 00000009 RWIX
    XINT 00007070 00000010 0000000b 00000005 RWIX
    SCIA 00007200 00000010 00000010 00000000 RWIX
    SCIB 00007210 00000010 00000010 00000000 RWIX
    SCIC 00007220 00000010 00000010 00000000 RWIX
    SCID 00007230 00000010 00000010 00000000 RWIX
    I2CA 00007300 00000040 00000022 0000001e RWIX
    I2CB 00007340 00000040 00000022 0000001e RWIX
    ADCA 00007400 00000080 00000080 00000000 RWIX
    ADCB 00007480 00000080 00000080 00000000 RWIX
    ADCC 00007500 00000080 00000080 00000000 RWIX
    ADCD 00007580 00000080 00000080 00000000 RWIX
    INPUT_XBAR 00007900 00000020 00000020 00000000 RWIX
    XBAR 00007920 00000020 00000020 00000000 RWIX
    SYNC_SOC 00007940 00000010 00000006 0000000a RWIX
    DMACLASRCSEL 00007980 00000040 0000001a 00000026 RWIX
    EPWM_XBAR 00007a00 00000040 00000040 00000000 RWIX
    CLB_XBAR 00007a40 00000040 00000000 00000040 RWIX
    OUTPUT_XBAR 00007a80 00000040 00000040 00000000 RWIX
    GPIOCTRL 00007c00 00000180 00000180 00000000 RWIX
    GPIODAT 00007f00 00000030 00000030 00000000 RWIX
    RAMLS_DATA 0000a000 00001000 00000000 00001000 RWIX
    RAMD0D1 0000b000 00001000 00000000 00001000 RWIX
    RAMGS_IPCBuffCPU1 0000c000 00001000 00000000 00001000 RWIX
    RAMGS_IPCBuffCPU2 0000d000 00001000 00000000 00001000 RWIX
    RAMGS_DATA 0000e000 00007000 00006ef3 0000010d RWIX
    CPU2TOCPU1RAM 0003f800 00000400 00000000 00000400 RWIX
    CPU1TOCPU2RAM 0003fc00 00000400 00000000 00000400 RWIX
    EMIF1 00047000 00000800 00000070 00000790 RWIX
    EMIF2 00047800 00000800 00000070 00000790 RWIX
    IPC 00050000 00000024 00000024 00000000 RWIX
    FLASHPUMPSEMAPHORE 00050024 00000002 00000002 00000000 RWIX
    DEV_CFG 0005d000 00000180 0000012e 00000052 RWIX
    ANALOG_SUBSYS 0005d180 00000080 00000048 00000038 RWIX
    CLK_CFG 0005d200 00000100 00000032 000000ce RWIX
    CPU_SYS 0005d300 00000100 00000082 0000007e RWIX
    ROMPREFETCH 0005e608 00000002 00000002 00000000 RWIX
    DCSM_Z1 0005f000 00000030 00000024 0000000c RWIX
    DCSM_Z2 0005f040 00000030 00000024 0000000c RWIX
    DCSM_COMMON 0005f070 00000010 00000008 00000008 RWIX
    MEMCFG 0005f400 00000080 00000080 00000000 RWIX
    EMIF1CONFIG 0005f480 00000020 00000020 00000000 RWIX
    EMIF2CONFIG 0005f4a0 00000020 00000020 00000000 RWIX
    ACCESSPROTECTION 0005f4c0 00000040 00000040 00000000 RWIX
    MEMORYERROR 0005f500 00000040 00000040 00000000 RWIX
    ROMWAITSTATE 0005f540 00000002 00000002 00000000 RWIX
    FLASH0_CTRL 0005f800 00000300 00000182 0000017e RWIX
    FLASH0_ECC 0005fb00 00000040 00000028 00000018 RWIX
    DCSM_Z1_OTP 00078000 00000020 00000020 00000000 RWIX
    DCSM_Z2_OTP 00078200 00000020 00000020 00000000 RWIX

    Kindest Regards

    Chris

  • Hello,

    is it possible to ask an experienced person to check if my implementation of the "faq-faq-how-do-i-use-simulink-custom-code-blocks-to-measure-code-execution-time-on-ti-c2000" article is correct?

    I see that the counter output is a uint32. Perhaps the syntax inside my System Initialize / Model Header / Model Source / System Outputs could require tweaking?

    Or perhaps the way I have set up the MemoryCopy and transferred data to the DataStore is not correct?

    I have zipped the slx model file that I am building and it contains an Atomic sub-system. Thank you in advance. Kindest regards.

    RML_TMS320F28379D_Test8_ProcessorLoad.zip

  • Chris,

    We're going to make the MW team aware of this post so they can help reply. Please give us a few days to sync with them, etc.

    Best,

    Matthew

  • Thank you Matthew,

    I will really appreciate the support of the MW team on this. It is important to me to prove out how processor intensive is the model that we plan to run.

    Kindest regards

    Chris

  • Hi Chris,

    Looks like the Memory Copy block in your model is not configured properly. The "Source code symbol" parameter under Source tab needs to specify the address of the variable in which the difference of the timer values is stored i.e, &dct1. Also, under Destination tab, the Sample time must be set to a value other than 'inf' (say 1.0) in order to read and display the timer difference value every step time. Setting it to 'inf' will read the value only once during model initialization.

    Best Regards,
    Ram Alla.

  • Thank you Ram, those tips really helped with my model now. I wanted to check and clarify things further.

    so the timer output is in microseconds if I have understood it correctly.

    my value is 2966 and the task is running at 0.01 s (that's what the Model Config Solver is set to)

    So can I divide 2966 us / 10000 us ? That would equal 0.2966.

    Is there any other further calculation required to get an estimate of processor load for this board? Does this value equate to 30% or 3% for example?

    Excuse my lack of knowledge in this area and if I ask trivial questions. It has been 6+ years since I last did these checks on a previous control unit. Thank you.

  • Hi Chris,

    The difference value of 2966 is the CPU timer count. To convert this to CPU time, need to multiply it with the CPU CLK time per tick.
    i.e, 2966 * (1/200)us = 15us apprx. (Considering 200MHz of CPU CLK)

    This is the time taken to execute the functionality of interest.
    Note that if interrupts are enabled, this time can vary depending on the execution time of the ISR.

    You can compute the % of CPU utilization as below:
    Considering the step time as 0.01sec, (15us/0.01s)*100 = 0.15%

    You may also cross check this by toggling a GPIO pin at the beginning and the at end of the subsystem or the functionality of your interest and verify it using Oscilloscope.

    Best Regards,
    Ram Alla.