S32DS, S32K144, how to make 10ms loop in main()

cancel
Showing results for 
Search instead for 
Did you mean: 

S32DS, S32K144, how to make 10ms loop in main()

810 Views
kimjunghyun
Contributor III

I had used Code Warrior and now I am using S32DS(S32 Design Studio for ARM)
But it is difficult to understand the functions and parameters supported by S32DS.
I think it would be easier than using S32DS if I make code by hand coding.
So I would like to ask you as following questions.

Purpose : how to make 10ms loop in main()
MCU : S32K144(68pin)

1. How to configure the Component Inspector?

2. Which components should I use at Components window? (from Components window to main.c window)

3. I hope there are some example code. (I already tried some example projects like FTM_Timer_Example on S32DS..)

 

I hope somebody help me soon.
Thank you.
Kim.

Labels (1)
2 Replies

243 Views
jiri_kral
NXP Employee
NXP Employee
0 Kudos

243 Views
jiri_kral
NXP Employee
NXP Employee

Hi Kim, 

LPIT timer is dedicated for such kind of task. You can set period in us and in Interrupt handler you can set some kind of flag and test the flag in the main loop - like this:

.

.

volatile int your_exec_fag = 0;

.

.

void LPIT_ISR(void)
{

   exec_flag = 1;

   LPIT_DRV_ClearInterruptFlagTimerChannels(FSL_LPIT1, (1 << LPIT_CHANNEL));

}

main()

{

.

.

   LPIT_DRV_GetTimerPeriodByUs(FSL_LPIT1, channel_num, 10000);  // set period to 10 000us (10ms)

.

.

   if (your_exec_flag!=0)

  {

      your_10ms_function();

     your_exec_flag = 0;

  }

For more details about LPIT you can look at LPIT_Example:

[Your DS32_ARM_install_path]\S32DS_ARM_v1.3\S32DS\S32_SDK_EAR_0.8.2\examples\driver_examples\lpit\LPIT_Example\ 

Jiri