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.

MSPM0G1106: timer Int Problem,

Part Number: MSPM0G1106

Tool/software:

Hello, in the software below, it enters the while loop in main once and does not enter again, the timer continues counting but does not return to the while loop again.


#include "GPIO_Func.h"
#include "ti_msp_dl_config.h"
#include "LCD_Func.h"
#include "RTC_Func.h"
#include "System_Init.h"
#include "stdio.h"

int val=0;
int RTC_Repeat_time;


void TIMER_0_INST_IRQHandler(void)
{
switch (DL_TimerG_getPendingInterrupt(TIMER_0_INST)) {
case DL_TIMER_IIDX_ZERO:
RTC_Repeat_time++;
/*
* Timer'ı durduruyoruz, yük değerini tekrar ayarlayıp
* tekrar başlatıyoruz
*/
// DL_TimerG_stopCounter(TIMER_0_INST);

/* Timer'ı 200 ms periyodunda tekrar başlatıyoruz */
/*
DL_TimerG_setLoadValue(TIMER_0_INST, TIMER_200_MILLISECONDS_TICKS);
DL_TimerG_startCounter(TIMER_0_INST);

/* GPIO pinlerini değiştir (LED'leri yak/söndür) */

break;
default:
break;
}
}

int main(void)
{
SYSCFG_DL_init();


Interrupt_Init();
Timer_Init();


RW_OFF;
LCD_Backlight_ON;
LCD_Init();
Sample_Loop() ;

// DS1307'ye saati ayarla
//writeTimeToDS1307(15, 9, 0, 4, 22, 8, 24); // Saat: 09:52:00, Gün: 5 (Cuma), Tarih: 22 Ağustos 2024
while (1) {


if(RTC_Repeat_time>5){
Read_Time_from_RTC();
char timeStr[16];
snprintf(timeStr, sizeof(timeStr), "%02d:%02d:%02d", hours, minutes, seconds);

char dateStr[16];
snprintf(dateStr, sizeof(dateStr), "%02d/%02d/%02d %s", date, month, year, dayStr);

// Zamanı üst satıra, tarihi alt satıra yazdır (ortalamalı ya da ortalamadan)
lcdPrintLines(timeStr, dateStr, 1, 1);
RTC_Repeat_time=0;
}

//delay_cycles(16000000);

}
}

  • Hi Burak,

    When you pause the program where are you located in code?

    I suggest putting a breakpoint in the timer ISR to see if you are hitting the timer ISR since you state the timer keeps running.

    Regards,
    Luke

  • I am too lazy to try it, but (and this is usually the problem in cases like this) if the MCU is set to go to sleep after servicing the interrupt, where would it end up if you hit pause?