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.

CCS: WTIMER : Cant Reset or assert (WTIMER1_TIMER_ICR) interrupt clear bit.

Other Parts Discussed in Thread: TM4C123GH6PM

Tool/software: Code Composer Studio

I am using PC6 on my TM4c123gh6pm microntroller and the issue is that the code works and i am getting a time capture from Wtimer but in its ISR the flag is not setting. ? Code composer studio shows me (*) asteriks at that position and in watch window it shows me type as:  READNONE/WRITE NONE. Why is it doing that? Whats the problem and the solution.

void PeriodMeasure_Init(void){
	// Enable pin PC6 for WTIMER1 WT1CCP0=  WTimer1 A

  noInterrupts();


  SYSCTL_RCGCGPIO_R   |= (1<<2);       // activate port C CLOCK
  SYSCTL_RCGCWTIMER_R |= (1<<1);      // activate Wtimer1 CLOCK


//GPIOPinUnlockGPIO(GPIO_PORTC_BASE, GPIO_PIN_6);     // Unlock the PD7 GPIO



  GPIO_PORTC_DIR_R &= ~(1<<6);       // make PC6 input
  GPIO_PORTC_AFSEL_R |= (1<<6);      // enable alt funct
  GPIO_PORTC_DEN_R |= (1<<6);        // enable Digital Function

  GPIO_PORTC_PCTL_R = (GPIO_PORTC_PCTL_R & 0xF0FFFFFF)+0x07000000;  //Configured as WTimer on Pin6

  WTIMER1_CTL_R &= ~0x00000001;     // disable timer1A during setup

  WTIMER1_CFG_R = 0x00000004;       // configure for 32-bit capture mode
  WTIMER1_TAMR_R = 0x00000017;      // configure for rising edge event
  WTIMER1_CTL_R &= ~0x0000000C;     // rising edge
  WTIMER1_TAILR_R = 0x00000000;     // start value
  WTIMER1_TAPR_R = 0xFFFF;            // activate prescale, PreScaler Counts: 65535 Time to Reset: 3.518
  WTIMER1_IMR_R |= 0x00000004;      // enable capture match interrupt
  WTIMER1_ICR_R |= (1<<2);       // clear timer0A capture match flag //Clear Flag

  WTIMER1_CTL_R |= 0x00000001;      // timer0A 24-b, +edge, interrupts

  NVIC_PRI24_R = (NVIC_PRI24_R & 0xFFFFFF1F) | (1<<5); //WTimer1A->priority 1
  NVIC_EN3_R |= 0x1;             // enable interrupt 96 in NVIC
  interrupts();
}

void WideTimer1A_Handler(void){
if(FirstRun==1){
  WTIMER1_ICR_R = 0x00000004;       // clear timer0A capture match flag //Clear Flag

  Periodlong = (WTIMER1_TAR_R - INT_TIME) & 0xFFFFFFFF;  // 32-bit, 12.5ns resolution
  Time=Periodlong*12.5e-9;


  INT_TIME = WTIMER1_TAR_R;            // setup for next
          }

FirstRun = 1;                        // set semaphore
WTIMER1_ICR_R = 0x00000004;       // clear timer0A capture match flag //Clear Flag
}


  • Hello Aurangzaib,

    Did you try looking at the register in the memory browser. Also check the RIS register to see which bits are being set.

    Also what you are using is something we refer to DRM. It is an approach we do not recommend on the forum, as it sets us back when debugging or reviewing user code. I would suggest using TivaWare API's instead.
  • I was following the Datasheet didnt know about Tivaware API / Driverlib at that time but now i managed to fix the issue it was a timing problem , code composer studio did not update the value of RIS at the time i was checking maybe due to some latency i dont know from where. Thanks for your reply. Ti e2e is most helpful. I will use API from onwards .

    Best Regards,
    Aurangzaib Jahangir
  • Hello Aurangzaib,

    Sometimes the CCS window does not update even if Auto-Refresh is set ON. It would be good to close the window and re-open it which generally tends to fix the issue.