S32K144 FlexTimer settings for free running counter

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

S32K144 FlexTimer settings for free running counter

2,348 Views
muhammadimranaf
Contributor II

Hi,

I am trying to configure FlexTimer to use a free running counter. I have selected System clock as source of clock. please tell me if I am doing it right and how do i read the status of counter. or please share some code for this FTM configurations.

// FTM0
  FTM0[0].CNTIN = FTM_CNT_COUNT(0); /*initize counter with 0*/
  FTM0[0].MODE = FTM_MODE_WPDIS(1); /*write protection disabled */
  FTM0[0].SC = FTM_SC_CLKS(1); /* clock source selection: System clock*/
  FTM0[0].SC = FTM_SC_PS(3); /* Prescaler */
  FTM0[0].MODE = FTM_MODE_FTMEN(1); /* FTM enable*/

Tags (2)
10 Replies

1,771 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

Yes, your code should look like this:

  FTM0[0].CNTIN = FTM_CNT_COUNT(0); /*initize counter with 0*/
  FTM0[0].MODE = FTM_MODE_WPDIS(1); /*write protection disabled */
  FTM0[0].SC = FTM_SC_CLKS(1); /* clock source selection: System clock*/
  FTM0[0].SC = FTM_SC_PS(3); /* Prescaler */

  FTM0[0].MOD = 0xFFFF;
  FTM0[0].MODE = FTM_MODE_FTMEN(1); /* FTM enable*/

 

If you want to configure FTM easier you can use SDK because it includes the FTM drivers and for application you can call these 2 functions :FTM_DRV_InitCounter and FTM_DRV_CounterStart.

 

Best regards,

Razvan

1,771 Views
muhammadimranaf
Contributor II

Hi Razvan,

Thanks for the help. Seems like it will work.

I was trying to search for SDK but i couldn't. can you please tell me the link where I can find SDK. It will be great if I can find SDK as I have so many questions that I guess can be answered witk SDK only. A quick reply will be much appreciated.

Best Regards,

0 Kudos

1,771 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

The SDK for S32K14x devices is delivered with S32 Design Studio IDE|NXP . I recommend to install S32 Design Studio for ARM v1.3 - Windows.

Best regards,

Razvan

0 Kudos

1,771 Views
muhammadimranaf
Contributor II

Hi,

yeah I am trying to download the same but i am not able to download it. This redirects to my home page. Do you have idea what is it.

Regards,

0 Kudos

1,771 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

I suppose that you are redirected to nxp home page because you are not logged in nxp web site.

If this doesn't solve the problem try to use other browser.

Best regards,

Razvan

0 Kudos

1,771 Views
muhammadimranaf
Contributor II

Hi,

sorry for disturbing you again and again. I am logged in. this link redirects me to my home page. not to any download link. I have tried changing the browser.

How do I download this. please help me in this.

Regards,

0 Kudos

1,771 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

I think I don't understand exactly your problem. 

Can you open this link :S32 Design Studio IDE|NXP or http://www.nxp.com/products/automotive-products/microcontrollers-and-processors/arm-mcus-and-mpus/s3... ?

Can you go to Download section and click on the Download button for S32 Design Studio for ARM 1.3?

After last step you are directed to some Terms and Conditions page?

Best regards,

Razvan

0 Kudos

1,771 Views
muhammadimranaf
Contributor II

Hi,

Sorry no success. I don't know what's wrong. I don't get to this terms and conditions page.

Regards,

Muhammad Imran Afzal

0 Kudos

1,771 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

I think you should set MOD register to 0XFFFF.

Best regards,

Razvan

0 Kudos

1,771 Views
muhammadimranaf
Contributor II

Hi Razvan,

Thanks for the comment. can you please confirm if my above code is ok.

and if possible give me some example for all settings for this free running counter.

Thanks and Regards,

0 Kudos