RTD GPT configuration

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

RTD GPT configuration

Jump to solution
221 Views
durga_choudhury
Contributor III

The details of the HW/SW this question pertains to is this:

S32K148 (on a custom board)

S32 Design Studio for S32 Platform

Version: 3.6.2

Build id: 250529 (Update 2)

 

The RTD version is as shown below:

durga_choudhury_0-1758920952334.png

 

I am including a GPT to my project. I want it to count up from 0 to 5000 and start over. The problem I am facing is there seems to be no way to configure this upper bound. This is a 16 bit counter and the SDK configurator does not seem to like any value other than 65535 (trying to do so makes the project invalid, please see the screenshot below:

durga_choudhury_1-1758921184994.png

 

If this value can only take a fixed value (65535) then I don't see it being a configurable parameter (and useful)

If this can take any value from 1 up to 65535 then the tool seems to be broken.

 

The only workaround that I have found is to change

#define FTM_CNT_MAX_VALUE 0x0000FFFF

to

#define FTM_CNT_MAX_VALUE 5000

in Ftm_Gpt_Ip.h (knowing that any such change will be overwritten the next time code is regenerated, but that is my only way to make progress right now)

If I am mistaken, please correct me. If not, please advise on the best way to proceed.

Tags (2)
0 Kudos
Reply
1 Solution
114 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @durga_choudhury 

It is shown as configurable in the Peripherals view because the driver is designed to be flexible. It can be reused to configure other timers with different resolutions, so having that value exposed makes it easier to adapt the setup for different use cases.

View solution in original post

0 Kudos
Reply
3 Replies
166 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @durga_choudhury 

I think there may be a misunderstanding regarding the GptChannelTickValueMax parameter. This value represents the maximum number of ticks that a channel can count. Since the FTM is a 16-bit timer, the resolution is:

2^{16} − 65,535 ticks

This value is mandatory, and that is why an error is displayed if a different value is set.

To define the desired timeout period for the channel, you should use the Gpt_StartTimer() function. For reference, you can consult the Gpt_example_S32K148 included with the RTDs.

 

BR, VaneB

0 Kudos
Reply
161 Views
durga_choudhury
Contributor III

Hello @VaneB 

 

Thanks for the clarification. I am still confused as to why a number that is a hard constant is configurable on the Peripherals view.

 

Regards

Durga Choudhury

Tags (2)
0 Kudos
Reply
115 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @durga_choudhury 

It is shown as configurable in the Peripherals view because the driver is designed to be flexible. It can be reused to configure other timers with different resolutions, so having that value exposed makes it easier to adapt the setup for different use cases.

0 Kudos
Reply