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:
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:
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.
Solved! Go to Solution.
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.
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} − 1 = 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
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.