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.

problems using AdcOffsetSelfCal function

Hi,

at the moment i experience some problems with AdcOffsetSelfCal() function. My Device is the F28035.

Before i start with my problem:

In general my code uses the same structure as for example HVPM_Sensored project. I have the Backround Tasks A, B, C and the MainISR, which is called at EOC pulse.

When not using AdcOffsetSelfCal() function everything works fine. I experience no problems. When i add the function to code the problems begin. As long as EnableFlag = 0 everything seems to work fine. But when i set it to 1 the Backround Tasks are not longer called. In General the Device stucks at the position where it was when i set EnableFlag to 1. The complete infinte loop stops running. In that condition the MainISR still works as it should.

Here the position of AdcOffsetSelfCal() in Code:

void main(void)
{
DeviceInit(); // Device Life support & GPIO

// Only used if running from FLASH (defined by Compiler)

#ifdef FLASH
// Copy time critical code and Flash setup code to RAM
// The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart
// symbols are created by the linker. Refer to the linker files.
MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash(); // Call the flash wrapper init function
#endif //(FLASH)

// CAN Init / Config
// can be found in DSP2803x_ECan.c
InitECana();
ConfigECana();

// Timing sync for background loops
// Timer period definitions found in device specific PeripheralHeaderIncludes.h
CpuTimer0Regs.PRD.all = mSec1; // A tasks (1ms)
CpuTimer1Regs.PRD.all = mSec5; // B tasks (5ms)
CpuTimer2Regs.PRD.all = mSec50; // C tasks (50ms)

// Tasks State-machine init
Alpha_State_Ptr = &A0;
A_Task_Ptr = &A1;
B_Task_Ptr = &B1;
C_Task_Ptr = &C1;

// Initialize PWM module
pwm1.PeriodMax = SYSTEM_FREQUENCY*1000000*T/2; // Prescaler X1 (T1), ISR period = T x 1
pwm1.HalfPerMax=pwm1.PeriodMax/2;
pwm1.Deadband = 3.0*SYSTEM_FREQUENCY; // 180 counts -> 3.0 usec for TBCLK = SYSCLK/1
PWM_INIT_MACRO(1,2,3,pwm1)

// Initialize PWMDAC module
// for Debugging only
pwmdac1.PeriodMax=500; // @60Mhz, 1500->20kHz, 1000-> 30kHz, 500->60kHz
pwmdac1.HalfPerMax=pwmdac1.PeriodMax/2;
PWMDAC_INIT_MACRO(4,pwmdac1) // PWM 4A,4B
PWMDAC_INIT_MACRO(6,pwmdac1) // PWM 6A,6B

// Initialize DATALOG module
// for Debugging only
dlog.iptr1 = &DlogCh1;
dlog.iptr2 = &DlogCh2;
dlog.iptr3 = &DlogCh3;
dlog.iptr4 = &DlogCh4;
dlog.trig_value = 0x1;
dlog.size = 0x0c8;
dlog.prescalar = 5;
dlog.init(&dlog);

AdcOffsetSelfCal();

.

.

.

.

Does anybody have an idea of how to solve it?

Thanks for your help!

// edit:

I found out, that the MainISR takes all the available calculation time. There is no time left for other code. The ISR gets called much more often then it should. At the moment i can measure a call freq. of about 250 kHz. Configured is 30 kHz. Without AdcOffsetSelfCal i have the configured 30 kHz and enough time for backround tasks.