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.

Help needed with CPU load calculations

Other Parts Discussed in Thread: TMS320VC5509A

TMS320VC5509A

BIOS 5.41.09.34

Code Composer  4.2.0.10017

Blackhawk USB510L JTAG emulator

RTDX kills my app

My first issue is that if I try to use RTDX while my target is running, eg using code composer Tools->RTA->CPU Load, my target crashes. I have reviewed all the TI BIOS manuals (which btw are only useful for upt CCS 3.x) and cannot find problem. I have same BIOS version in both project settings and macros like BIOS_CG_ROOT. I have in my tcf

bios.enableRealTimeAnalysis(prog);
bios.enableRtdx(prog);

I have interrupts 25 and 26 set to BIOS/TCF defaults, ie RTDX_Poll() and RTDX_H2TPoll()

To be honest, I have not seen this working since an older Code Composer, BIOS, and using the Spectrum Digital DSK5509A development kit (with its onboard USB emulator).

My questions below for now are more important, but any advice here is welcome.

Troubles trying to understand Implicit Instrumentation

I decided that my final product will have built in CPU load logging anyway, so kind of gave up on RTDX. Read all the TI docs, would seem pretty simple, I just need to periodically read (and clear) the IDL_busyObj, which the IDL_cpuLoad object function writes to. Also need to access the CLK_D_idletime, and GBL_getFrequency(). This gives me all I need, N, I1, M, and T for the formula in SPRU423H 3.8.1. Now the problems started

[1]CLK_D_idletime. I have TCF set so is autocalculated as per SPRU423H. I can see this in my debugger, coff etc, and the value seems reasonable at about 370. But when try to compile it in I get link error,  it must be declared local (static)? How can I access this idle time count? Obviously with RTDX the host must get it somehow.

[2]IDL_busyObj. This is a STS_Obj, but apparently is used in some adhoc manner. SPRU423H makes that clear, "count provides a measure of N", "total provides the value T". So it is not really a STS_Obj now is it? Just a memory location used in some specific manner for CPU load. Anyway, N==count==STSobj->num seems as I expected. But getting unusual T==total==STS->obj.acc. According to SPRU423J "The IDL_busyObj total provides the value T in units of the high-resolution clock.". I have TCF setup so 1000.0 microseconds = 1 high resolution tick. I was expecting this T value to be simply the milliseconds expired. After quite some time and mind bending, it seems this is not exactly the case. It looks like the first 16bits is a negative count in clock ticks (or 1mS in my case). I dont know what the 2nd 16bits is for. So for example over 100mS the value is 0xFF9C = -100. Once again the second value seems to change but I cant make any sense of it. Please help me to understand this.

  • Ben,

    Your question is strictly related to DSP/BIOS operation, therefore I will move your post there and see if you can get better help from the experts there.

    Regards,

    Rafael

  • Rafael, Thanks for passing this on. Unfortunately noone is responding. Can you stir up some TI support. Regards, Ben.

  • Ben - If RTDX is killing your target, you can still use RTA in stop-mode-only mode. See this article:

    http://processors.wiki.ti.com/index.php/BIOS_5_Real-Time_Analysis_(RTA)_in_CCSv4

    Note, however, that stop mode does not support the CPU Load graph, so this may not help you.

    I will get back to you on your questions about the CPU load calculation.

    Thanks,

    Chris

  • Ben - I read through section 3.8.1 and I'd agree that it's confusing. In particular, I think it's misleading in that I don't think you need CLK_D_idletime or GBL_getFrequency(), the values in the IDL_busyObj should be sufficient for calculating the load.

    I've created a wiki article here explaining how the IDL_busyObj is read by RTA.

    http://processors.wiki.ti.com/index.php?title=Calculating_DSP/BIOS_5_CPU_Load

    This article is probably missing some important details such as how you retrieve the IDL_busyObj, and maybe suggestions for how to go about polling this object periodically. Also, an actual snippet of C code for doing the load calculation would probably be helpful.

    If the information in this article is enough to get you going, it'd be great if you could update that article or share some of what you did here.

    Thanks,

    Chris

  • Thanks Chris. Tried, and it does work, gives me the same results I was getting using more complex formula and CLK_D_idletime or GBL_getFrequency(). I dont really have anything to add to wiki, other than obvious points (eg make sure you sample often enough to prevent overflow of the IDL_busyObj, is an average so to get more precise peak measurement need to poll more frequently).