TMS320F28335:f28335(ccs code running problem):The results of single-step and continuous running of the ccs program are inconsistent

Part Number: TMS320F28335

Tool/software:

When I ran the code generated by psim2024, I found a strange problem. The results of single step and continuous operation of ccs program are inconsistent!

As shown in the figure, I9=(I1-2.5)*20, I14=I9 in my program, the result of continuous running is completely wrong, and the result of single step running when the breakpoint is set is correct.

ps: 

1.  I didn't turn on compiler optimization

2. The data is of float type, and the error is independent of the data type

3. Using the volatile keyword to modify data is also ineffective

Other conditions are as follows:
Emulator: XDS100V1
Controller: f28335
ccs version: ccs6.1.3

  • I would like to add a little information: my program has always had a warning after compilation, because it does not affect the operation of the program, so I ignored it, as follows:
    1. #10063-D entry-point symbol other than "_c_int00" specified: "code_start"
    2. #99922 C:\Users\licai\AppData\Local\Temp\023602: Invalid CIE reference 0xffff0000 for the FDE at offset 0x00000192 in the .debug_frame section()
    3. Build variable 'XDAIS_CG_ROOT' cannot be resolved.
    4. Invalid project path: Include path not found (\packages\ti\xdais).
    Will these warnings affect the correctness of my program?

  • Hello,

    I suspect you are running into a known issue:

    https://sir.ext.ti.com/jira/browse/EXT_EP-10722

    Please check the debugger memory map and see if the access size is set to AS2. If so, you can set it to AS4 as mentioned in the above link.

    Thanks

    ki

  • Hello,

    Your answer would be appreciated

    I changed the only AS2 in gel file to AS4, but the problem still hasn't been solved.

    Meanwhile, I would like to confirm a question, that is, will this only affect the observed value in the watch expression window, or is my real value also wrong?

    Thanks

  • I made two other discoveries

    1: When I do not power the sampling circuit, i.e. fGblI1 is 0, the result is correct in continuous running, and wrong once the sampling circuit starts working.

    2: When the sampling circuit is working, the continuous running data is not correct, the data will be updated after a pause (expression background shows yellow), the result is correct, and the correct result is kept unchanged during continuous running

  • I changed the only AS2 in gel file to AS4, but the problem still hasn't been solved.

    I noticed that you changed the access size for PF2 which is 0x7000 - 0x7FFF

    However the variables you show are at address 0x9E**. Hence it looks like you need to change the access size for L1 SARAM instead.

    ccs version: ccs6.1.3

    Also, please note that you are using a very old and unsupported version for CCS. I suggest updating to a current version.

  • I upgraded ccs to the latest version, the problem still exists.(There's no problem with checking "halt the target before........") If it is convenient, could you please explain in detail how to change the access size of L1 SARAM?

    Meanwhile, I would like to confirm a question, that is, will this only affect the observed value in the watch expression window, or is my real value also wrong?

  • If it is convenient, could you please explain in detail how to change the access size of L1 SARAM?

    It is the same as how PF2 is configured in your screenshot. Do the same for L1 SARAM using GEL_MapAddStr

    will this only affect the observed value in the watch expression window, or is my real value also wrong?

    The watch expression is showing the incorrect value because it is reading two halves of a float value at different times. This is not a problem when the target is halted. But when doing real-time access with continuous refresh the watch expression can show an "in between" value where only one half is updated.

  • I'm sorry for taking so long to reply you due to a business trip.

    Now I can confirm that it is not the debugger memory map that is causing the problem, but the delay. But problems remain

    The following is the ccs program framework for PSIM generation:
    Interrupt void Task()
    {
    ................
        delay_MS(10ms) // This is correct only if the delay is added here
        fADC3 = PSM_AdcGetValBySoc(0) * (1 * 3.0/4096); // Get DC value from ADC_A0.
        fADC3_1 = PSM_AdcGetValBySoc(1) * (1 * 3.0/4096); // Get DC value from ADC_A1.
        fADC3_2 = PSM_AdcGetValBySoc(2) * (1 * 3.0/4096); // Get DC value from ADC_A2.
        fADC3_3 = PSM_AdcGetValBySoc(3) * (1 * 3.0/4096); // Get DC value from ADC_A3.
    ...............
    }
    ////////////////////////////////////////////////////////////////////////////////////    The interrupt service routine for 20 kHz. It is called in every 20-kHz cycle.


    void Initialize ()
    {
    ...

    ////////////////////////////////////////////////////////////////////////////////////    The initialization routine. It initializes hardware.


    void main ()
    {
        Initialize();
        PS_EnableIntr(); // Enable Global interrupt INTM
        PS_EnableDbgm();
        for (;;) {
        }
    }

    ////////////////////////////////////////////////////////////////////////////////////   The main program. It calls the initialization routine, and runs an infinite loop.

    The program can run correctly only when a delay is added before the digital-to-analog conversion in Interrupt void Task(), but only when the delay is more than 10ms. However, this delay is too long for my switching cycle, leading to problems in my closed-loop feedback. What should I do to solve it?

  • Now I can confirm that it is not the debugger memory map that is causing the problem

    Did you try changing the attributes for the correct memory range?

    I ask, because:

    The program can run correctly only when a delay is added before the digital-to-analog conversion in Interrupt void Task(), but only when the delay is more than 10ms. However, this delay is too long for my switching cycle, leading to problems in my closed-loop feedback. What should I do to solve it?

    The original issue regarding the debugger memory map can result in a timing issue. Like the one you mention about. The issue is that if the default 16-bit access size is used for the memory range, then the memory read for the variable value is done in two operations and on a running device, depending on the timing, the value may change in the middle of these two operations resulting in an invalid value for the variable. Slowing the system down with a delay would lessen the odds of this happening and resulting in the variable displaying the correct value.

    Everything you describe is in line with the prior issue I mentioned. Hence I would like to confirm if you did set the correct access size for the correct memory range.

    Thanks

    ki 

  • Yes, I tried the method you provided, the result is still the same, continuous run time data results error

    hotmenu F28335_Memory_Map()
    {
    GEL_MapReset();
    GEL_MapOn();

    /* Program memory map */
    GEL_MapAddStr(0x0,0,0x400,"R|W|AS4",1); /* M0 SARAM */
    GEL_MapAddStr(0x400,0,0x400,"R|W|AS4",1); /* M1 SARAM */
    GEL_MapAddStr(0x4000,0,0x1000,"R|W|AS4",1); /* Zone 0 */
    GEL_MapAddStr(0x8000,0,0x1000,"R|W|AS4",1); /* L0 SARAM */
    GEL_MapAddStr(0x9000,0,0x1000,"R|W|AS4",1); /* L1 SARAM */
    GEL_MapAddStr(0xA000,0,0x1000,"R|W|AS4",1); /* L2 SARAM */
    GEL_MapAddStr(0xB000,0,0x1000,"R|W|AS4",1); /* L3 SARAM */
    GEL_MapAddStr(0xC000,0,0x1000,"R|W|AS4",1); /* L4 SARAM */
    GEL_MapAddStr(0xD000,0,0x1000,"R|W|AS4",1); /* L5 SARAM */
    GEL_MapAddStr(0xE000,0,0x1000,"R|W|AS4",1); /* L6 SARAM */
    GEL_MapAddStr(0xF000,0,0x1000,"R|W|AS4",1); /* L7 SARAM */
    GEL_MapAddStr(0x100000,0,0x100000,"R|W|AS4",1); /* Zone 6 */
    GEL_MapAddStr(0x200000,0,0x100000,"R|W|AS4",1); /* Zone 7 */
    GEL_MapAddStr(0x300000,0,0x40000,"R|W|AS4",0); /* FLASH */
    GEL_MapAddStr(0x380080,0,0x00009,"R|W|AS4",0); /* ADC_cal function*/
    GEL_MapAddStr(0x380090,0,0x00001,"R|W|AS4",0); /* PARTID value */
    GEL_MapAddStr(0x380400,0,0x00400,"R|W|AS4",0); /* OTP */
    GEL_MapAddStr(0x3f8000,0,0x1000,"R|W|AS4",1); /* L0 SARAM Mirror */
    GEL_MapAddStr(0x3f9000,0,0x1000,"R|W|AS4",1); /* L1 SARAM Mirror */
    GEL_MapAddStr(0x3fA000,0,0x1000,"R|W|AS4",1); /* L2 SARAM Mirror */
    GEL_MapAddStr(0x3fb000,0,0x1000,"R|W|AS4",1); /* L3 SARAM Mirror */
    GEL_MapAddStr(0x3fe000,0,0x2000,"R|W|AS4",0); /* BOOT ROM */

    /* Data memory map */
    GEL_MapAddStr(0x000,1,0x400,"R|W|AS4",1); /* M0 SARAM */
    GEL_MapAddStr(0x400,1,0x400,"R|W|AS4",1); /* M1 SARAM */
    GEL_MapAddStr(0x800,1,0x1800,"R|W|AS4",1); /* PF0 */
    GEL_MapAddStr(0x4000,1,0x1000,"R|W|AS4",1); /* Zone 0 */
    GEL_MapAddStr(0x5000,1,0x1000,"R|W|AS4",1); /* PF3 */
    GEL_MapAddStr(0x6000,1,0x1000,"R|W|AS4",1); /* PF1 */
    GEL_MapAddStr(0x7000,1,0x1000,"R|W|AS4",0); /* PF2 */
    GEL_MapAddStr(0x8000,1,0x1000,"R|W|AS4",1); /* L0 SARAM */
    GEL_MapAddStr(0x9000,1,0x1000,"R|W|AS4",1); /* L1 SARAM */
    GEL_MapAddStr(0xA000,1,0x1000,"R|W|AS4",1); /* L2 SARAM */
    GEL_MapAddStr(0xB000,1,0x1000,"R|W|AS4",1); /* L3 SARAM */
    GEL_MapAddStr(0xC000,1,0x1000,"R|W|AS4",1); /* L4 SARAM */
    GEL_MapAddStr(0xD000,1,0x1000,"R|W|AS4",1); /* L5 SARAM */
    GEL_MapAddStr(0xE000,1,0x1000,"R|W|AS4",1); /* L6 SARAM */
    GEL_MapAddStr(0xF000,1,0x1000,"R|W|AS4",1); /* L7 SARAM */
    GEL_MapAddStr(0x100000,1,0x100000,"R|W|AS4",1); /* Zone 6 */
    GEL_MapAddStr(0x200000,1,0x100000,"R|W|AS4",1); /* Zone 7 */
    GEL_MapAddStr(0x300000,1,0x40000,"R|W|AS4",0); /* FLASH */
    GEL_MapAddStr(0x380400,1,0x00400,"R|W|AS4",0); /* OTP */
    GEL_MapAddStr(0x380080,1,0x00009,"R|W|AS4",0); /* ADC_cal function*/
    GEL_MapAddStr(0x380090,1,0x00001,"R|W|AS4",0); /* PARTID value */
    GEL_MapAddStr(0x3f8000,1,0x1000,"R|W|AS4",1); /* L0 SARAM Mirror */
    GEL_MapAddStr(0x3f9000,1,0x1000,"R|W|AS4",1); /* L1 SARAM Mirror */
    GEL_MapAddStr(0x3fA000,1,0x1000,"R|W|AS4",1); /* L2 SARAM Mirror */
    GEL_MapAddStr(0x3fb000,1,0x1000,"R|W|AS4",1); /* L3 SARAM Mirror */
    GEL_MapAddStr(0x3fe000,1,0x2000,"R|W|AS4",0); /* BOOT ROM */
    }

  • Looks like you changed the access size to 4 for all ranges. Not sure if you want to do that and what the impact is. I would limit it to the memory ranges in question.

    In any case I was pretty certain it was the access size issue. Can you share your program with me? The out file for the one with the issue. Ideal would be if you can share your whole project. If you wish to share privately please start a private E2E conversation with me.

  • I also try limit it to the memory ranges in question, The results are questionable. I will provide my whole project file to you, thanks for your help.Hope you're in good health and everything goes well with your work!

      soft-switching-3.0 (C code).zip