Crash while calling an SDK functinon

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Crash while calling an SDK functinon

Jump to solution
540 Views
gauravbanyal
Contributor IV

Hello,

I am facing a crash which I don't understand.

The scenario is, the MCU is in VLLS3 state and in this state, the LPTMR instance zero (LPTMR0) is running with LPO as the clock source. The system wakes and goes to RUN state  due to a pin interrupt and in the main() function, there is a call to "LPTMR_GetCurrentTimerCount(LPTMR0)" LPTMR API from the SDK. At this point, the system crashes and re-boots.

I have also tried to read some other registers of the TIMER LPTMR0 and every time I try to read any register, the application re-boots.

Somebody please help me whats the reason for this. 

Thanks,
Gaurav.

Tags (1)
0 Kudos
1 Solution
360 Views
mjbcswitzerland
Specialist V

Hi

Before you can read the LPTMR registers you need to enable clocks to it by using something like

POWER_UP(5, SIM_SCGC5_LPTIMER);

This is *(unsigned long *)0x40048038 |= 0x00000001; at its lowest level.

This is valid after each reset, even of the LPTMR otherwise may be operating.

Regards

Mark

View solution in original post

0 Kudos
1 Reply
361 Views
mjbcswitzerland
Specialist V

Hi

Before you can read the LPTMR registers you need to enable clocks to it by using something like

POWER_UP(5, SIM_SCGC5_LPTIMER);

This is *(unsigned long *)0x40048038 |= 0x00000001; at its lowest level.

This is valid after each reset, even of the LPTMR otherwise may be operating.

Regards

Mark

0 Kudos