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.

HCCal problem

Other Parts Discussed in Thread: CONTROLSUITE

When calling HRCAP_Cal from inside the HRCAP example, I get this this error:

Can't find a source file at "C:\TI\controlSUITE\libs\utilities\hrcap_hccal\type0\v100\source\Debug/../HCCal_Type0.c"

"HCCal_Type0_V1.h" is included and everything compiles and runs correctly, until  it hangs here.

   while (status!=2)                       // While calibration is incomplete
   {
       status = HRCAP_Cal(1,HCCAPCLK_PLLCLK, &EPwm8Regs);
       if (status == HCCAL_ERROR) 
       { 
	       ESTOP0;                        // If there is an error on HRCAP, stop and check 98 MHz < PLL2CLK < 120 MHz .
       }
   }

I can't find any reference to HCCal_Type0.c, so I have no idea why the compiler is looking for that file.

Any ideas?

Thanks,
Aron

  • Hi Aron,

    Any ideas?

    I hope you've taken care of all include header files. When you don't call the calibration function, does the code run then?

    Regards,

    Gautam

  • Hi Gautam,

    The file is run directly from the example and all includes are present and functional. If I comment out the call function it works with no errors. There is not a HCCal_Type0.c file to be found anywhere in any documentation or in any of the ti directories. Nor I can find a reference to it in any of the code. I just can't figure out why this error would exist

    Aron.

  • There is not a HCCal_Type0.c file to be found anywhere in any documentation or in any of the ti directories.

    Yup, I did notice that. I hope you've also included these lib files to your project:

    Regards,

    Gautam

  • They're included. The problem occurs with the example, which has both in it:

    C:\ti\controlSUITE\device_support\f2806x\v136\F2806x_examples_ccsv5\hrcap_capture_hrpwm

    Aron

  • The problem occurs with the example, which has both in i

    You've to include only one of them according to your mcu. You should use the FPU one for F28069.

    Regards,

    Gautam

  • Actually, I was wrong, I did not read the extension. The example contains both HCCal_Type0_V1.h and HCCal_Type0_V1_fpu32.lib.

    Aron

  • Actually, I was wrong, I did not read the extension. The example contains both HCCal_Type0_V1.h and HCCal_Type0_V1_fpu32.lib.

    Yes, you need the above 2 files. Also, I did check the above example on my F28069 controlStick and it works very well without any errors!

    Try cleaning your workspace or create a new workspace and re-import the above project. Let me know what you observe.

    Regards,

    Gautam

  • I have tried and the error persists. Some new information though, the first iteration of the calibration routine, in the main function, runs without incident. It's only when in the for loop that the routine hangs up.

  • It's only when in the for loop that the routine hangs up



    That's strange Aron! Over here its working very fine. Now it gets tougher to identify the bug :)

    Now it all depends on you to spot the bug.

    Regards,

    Gautam

  • Well, to make this more interesting, I found the problem only occurs with interrupts enabled. I also found this: http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/250391.aspx?pi303962=1

    Still working on it...

    Thanks Gautam,

    Aron

  • Yes the above post does seem interesting and helpful. Do keep us informed.

    Regards,

    Gautam

  • I noticed the reference manual shows two implementations of this function. One for a pre cal, where it's in a loop untill it returns a 2, then one for use in a slow aplication loop, where ESTOP; is excuted if the cal function retunrs an error. This is, however, not how the example code is written. So when I changed this:

       for (;;)
       {
    		if (datacounter == 5)
    		{
    		__asm (" nop");                                // Set breakpoint here for debug
    		}
    		
    		// Run calibration routine periodically in background using HRCAP1 internally tied to HRPWM8 output.
    		status = 0;                                      // New calibration not complete
            while (status!=2)                                // While calibration is incomplete
            {
                status = HRCAP_Cal(1,HCCAPCLK_PLLCLK, &EPwm8Regs);
                if (status == HCCAL_ERROR) 
                { 
    	            ESTOP0; // If there is an error on HRCAP, stop and check 98 MHz < PLL2CLK < 120 MHz .
                }
            }
    	}
    
    }
    

    to this:

       for (;;)
       {
    		if (datacounter == 5)
    		{
    		__asm (" nop");                                // Set breakpoint here for debug
    		}
    		
    		// Run calibration routine periodically in background using HRCAP1 internally tied to HRPWM8 output.
    	                                      
                status = HRCAP_Cal(1,HCCAPCLK_PLLCLK, &EPwm8Regs);
                if (status == HCCAL_ERROR) 
                { 
    	            ESTOP0; // If there is an error on HRCAP, stop and check 98 MHz < PLL2CLK < 120 MHz .
                }
    	}
    
    }
    

    The code ran without error. Perhaps this is what was meant by do not run the function more than every 1600 cycles. I thought it meant do not run the function, as shown with the while loop, every 1600 cycles, but maybe they meant do not run the function, by it's self, more than once every 1600 cycles.

    Either way, it seems to be working now.

    Aron

  • That's great, Aron. Please close the thread by verifying the answer.

    Regards,

    Gautam