Hard Fault using GetPeriodTicks function of TimerUnit

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

Hard Fault using GetPeriodTicks function of TimerUnit

714 Views
zenomaspoli
Contributor III

Hi,

I'm using Prosessor Expert for the programmation of the K60D100M tower.

I've added a Timer Unit, and i want to use the GetPeriodTicks function but at the end of that function, after the return,

the programm stuck in the hard fault.

I had a look to the HSFR Register but the of VECTTBL and FORCED bit have value 0

The timers works well, and i can even chanche the frequency by using the SetPeriodTicks function, but when i try to get the

value of tick per period i get stuck in the PE_ISR(Cpu_ivINT_Hard_Fault).

Any advice?

zeno

5 Replies

541 Views
BlackNight
NXP Employee
NXP Employee

You might add a special Processor Expert component which helps debugging hard faults:

A Processor Expert Component to Help with Hard Faults | MCU on Eclipse

Beside of that: which timer did you use? You might get a hardfault if you are using a realtime clock timer source and you have it not clocked (no battery attached).

541 Views
zenomaspoli
Contributor III

I'm using a TimerUnit_LDD not the RTC_LDD, i'll have a look to the component!
thank you Erich

0 Kudos

541 Views
vfilip
NXP Employee
NXP Employee

Hello,

could you please post here some simple project in order to reproduce it on our side? generally such behavior should not occur in case of using LDD components.

Best regards

Vojtech Filip

Processor Expert Support Team

0 Kudos

541 Views
zenomaspoli
Contributor III

Here's a piece of program that is already enough for get the hadr fault, this program will never reach

the "fcounter=1/TU1_GetInputFrequency(TimerData)*(uint32_t)Period;" command

    LDD_TError Error;

TU1Properties.jpg

    LDD_TDeviceData* DACData;

    LDD_TDeviceData* TimerData;

    LDD_TDeviceData* Led1Data;

    TU1_TValueType*  Period;

    

int main(void)

{

  PE_low_level_init();

  Led1Data     =    GPIO1_Init(NULL);

  DACData     =    DA1_Init(NULL);

  TimerData =     TU1_Init(NULL);

  Error=TU1_GetPeriodTicks(TimerData,Period);

  fcounter=1/TU1_GetInputFrequency(TimerData)*(uint32_t)Period;

  #ifdef PEX_RTOS_START

    PEX_RTOS_START();             

  #endif

}

0 Kudos

541 Views
zenomaspoli
Contributor III

Founded out !
doing like that the pointer 'Period' wasent inizialised,
I've added an ' TU1_TValueType  Period ' and chanched the old in ' TU1_TValueType*  Periodptr ',

and than just: Periodptr=&Period;

I dont know if its the best way, but it works.

0 Kudos