Hard Fault using GetPeriodTicks function of TimerUnit

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Hard Fault using GetPeriodTicks function of TimerUnit

1,003 次查看
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 回复数

830 次查看
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).

830 次查看
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 项奖励
回复

830 次查看
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 项奖励
回复

830 次查看
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 项奖励
回复

830 次查看
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 项奖励
回复