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.

F28M36P63C2: Problem with reading or writing CPUTimer0.InterruptCount from main application.

Part Number: F28M36P63C2


Hi TIers,

I am running into a strange problem. When I want to read CPUTimer0.InterruptCount from the main application, the register stops updating and the ISR doesn't fire up anymore. Values in RegsAdrr are still updating though. In my case I stay stuck in the while loop in delayUs(). Also, I have the same problem when I try to set CPUTimer0.InterruptCount=0 from the main application.

Thanks for your help!

systemControlError_t ConfigureAndStartCPUTimer0(const float period){
    if(period <= 0.0) return BAD_INPUT_ARGUMENT;

    enableCPUTimer0Clock();
    ConfigCpuTimer(&CpuTimer0, SYSTEM_FREQUENCY, period);
    StartCpuTimer0();

    return SYS_CTL_NO_ERROR;
}

interrupt void cpuTimer0ISR(void){
    CpuTimer0.InterruptCount++;
    // Acknowledge this interrupt to receive more interrupts from group 1
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}


void InitializeDS28EC20(void){
    InitializeChecksum();
    EALLOW;
    GpioCtrlRegs.GPBMUX1.bit.GPIO45 = 0; // SET PIN AS GPIO FOR ONE WIRE PIN
    GpioCtrlRegs.GPBDIR.bit.GPIO45 = 1; // SET DIRECTION 1=OUT 0=IN
    EDIS;
    GpioDataRegs.GPBSET.bit.GPIO45 = 1; // INIT THE PIN

    EALLOW;
    PieVectTable.TINT0 = &cpuTimer0ISR;
    EDIS;

    ConfigureAndStartCPUTimer0(CPU_TIMER_0_PERIOD_US); //CpuTimer0 interrupts every CPU_TIMER_0_PERIOD us

    // Enable TINT0 in the PIE: Group 1 interrupt 7
    IER |= M_INT1;
    PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
}

void delayUs(const uint32_t delayUs){
    uint32_t tic = CpuTimer0.InterruptCount;
    while((CpuTimer0.InterruptCount - tic) < delayUs);
}

inline void writeOne(void){
    setBusLow();
    delayUs(5); // Tw1l
    releaseBus();
    delayUs(60); //Tslot should be at least 65us (60+5)
}