I have the DK-TM4C129x evaluation board on which actually XM4C129XNCZADI 137AK3SW G1 is mounted.
Now, I have been start porting netMF 4.3 PK to TM4C129x controller.
I could not get the correct free run value from timer0. Is this bug of chip(XM4C129x)?
I have implemented test code to get the value by using snap shot function of times0 as following.
My test code
BOOL HAL_Time_Initialize()
{
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&g_sContext, "timers");
UARTprintf("FrameDraw\n");
//
// Initialize timer status display.
//
GrStringDraw(&g_sContext, "Timer 0:", -1, 100, 108, 0);
//
// Enable the peripherals used by this example.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
//
// Enable processor interrupts.
//
MAP_IntMasterEnable();
//
// Configure the two 32-bit periodic timers.
//
MAP_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
uint32_t ui32Config = HWREG(TIMER0_BASE + TIMER_O_TAMR);
HWREG(TIMER0_BASE + TIMER_O_TAMR) = ui32Config | TIMER_TAMR_TASNAPS;
ui32Config = HWREG(TIMER0_BASE + TIMER_O_TBMR);
HWREG(TIMER0_BASE + TIMER_O_TBMR) = ui32Config | TIMER_TBMR_TBSNAPS;
MAP_TimerLoadSet(TIMER0_BASE, TIMER_A, SYSTEM_CLOCK_HZ / 2); //for test only 0.5sec, finally will be set to 1us.
//
// Setup the interrupts for the timer timeouts.
//
MAP_IntEnable(INT_TIMER0A);
MAP_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
//
// Enable the timers.
//
MAP_TimerEnable(TIMER0_BASE, TIMER_A);
return CPU_INTC_ActivateInterrupt(INT_TIMER0A, Timer0IntHandler, 0);
}
void Timer0IntHandler(void* param)
{
MAP_IntMasterDisable();
//
// Clear the timer interrupt.
//
MAP_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
gu64LastValue = TimerFreeRunValueGet(TIMER0_BASE, TIMER_A);
if (HAL_Time_CurrentTicks() >= gu64NextEvent)
{
HAL_COMPLETION::DequeueAndExec();
}
UARTprintf("Timer A=0x%x\n\r", HWREG(TIMER0_BASE + TIMER_O_TAV));
UARTprintf("Timer B=0x%x\n\r", HWREG(TIMER0_BASE + TIMER_O_TBV));
//
// Toggle the flag for the first timer.
//
HWREGBITW(&g_ui32Flags, 0) ^= 1;
//
// Update the interrupt status on the display.
//
GrStringDraw(&g_sContext, (HWREGBITW(&g_ui32Flags, 0) ? "1" : "0"), -1, 195, 108, 1);
MAP_IntMasterEnable();
}
Serial Terminal Output
A=0x39384d4
B=0x393
A=0x39384d4
B=0x393
A=0x39384d4
B=0x393
.
.
.
.
Does anybody knows that free run value is not changed?