Dear Mr/Mrs,
I am working on lifetime timer on MPC5777C. I set my contiunging period maximum.
When I try to debug my controller on S32, My current_uptime variable is like below;
Start: 1111 1111 1111 1111 1111 1111 1111 1111 | 0000 0000 0000 0000 0000 0000 0000 0000
Time N = 1111 1111 1111 1111 1111 1111 1111 0110 | 0000 0000 0000 0000 0000 0000 0000 0000
Time N-1 = 1111 1111 1111 1111 1111 1111 1111 0101 | 0000 0000 0000 0000 0000 0000 0000 0000
Time N-2 = 1111 1111 1111 1111 1111 1111 1111 0100 | 0000 0000 0000 0000 0000 0000 0000 0000
Time N-3 = 1111 1111 1111 1111 1111 1111 1111 0011 | 0000 0000 0000 0000 0000 0000 0000 0000
Time N-4 = 1111 1111 1111 1111 1111 1111 1111 0010 | 0000 0000 0000 0000 0000 0000 0000 0000
But it should be FFFFFFFFF start of system. What make could it like that?
I share my source code below;
void lifetime_timer_init(void)
{
PIT->MCR |= 4; // clock for RTI Timers is enabled
PIT->TIMER[1].LDVAL = 0x0xFFFFFFFF; // setup timer 1 for maximum counting period
PIT->TIMER[1].TCTRL |= 5; // chain timer 1 to timer 0, timer1 start, disable timer1 interrupt
PIT->TIMER[0].LDVAL= 0xFFFFFFFF; // setup timer 0 for maximum counting period
PIT->TIMER[0].TCTRL |= 1; // start timer 0
}
lifetime_timer_init();
while(1)
{
current_uptime = 0;
current_uptime = (PIT->LTMR64H );
current_uptime= current_uptime <<32;
current_uptime = current_uptime + PIT->LTMR64L;
}
Best Regards,