Flextimer interrupt with GPT for S32k146 [Autosar MCAL ]

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

Flextimer interrupt with GPT for S32k146 [Autosar MCAL ]

1,739 Views
YoussefGhorab
Contributor I

Hello,

I have an issue with Generating accurate timer interrupt with FTM_5_CH_0_CH_1 

as when starting the GPT timer for example with  GPT_StartTimer(timer channel , time_needed)

where time needed is equal to 12 ms  which corrosponds to 15000 tick for 1250000 hz 

but i am getting the ISR each 6 ms instead of 12 ms 

here is the configuration done on Tresos 

GPT Configuration:

I have added new entry in GPTChannelConfiguration for FTM5 

and GPT channel tick frequency is 1250000 

GPT channel CLk src ref - > FTM_5 clock 

GPT FTM Prescaler = 32 

GPT FTM channel clk src=system_clock 

MCU configuration :

MCU peripheral clock config for FTM5 is on SPLL 

FTM5 clk in MCU clock reference point is 40 MHZ 

for the SPLL:

SPLL freq is 160 Mhz

SPLL div 2 freq is 20 Mhz

SPLL div 1 freq is 40 Mhz 

so what is wrong and leading to getting this issue ? 

Labels (1)
0 Kudos
Reply
2 Replies

1,557 Views
cuongnguyenphu
NXP Employee
NXP Employee

Based on your thread on Community, I have some clues:
GPT FTM channel clk src=system_clock  -> FTM clock is gotten from System clock of MCU module. So even you configured SPLL div 1 to 40 Mhz, FTM doesn’t get this source clock
If you want to keep GPT FTM Prescaler = 32 , then check that your System clock equals 40Mhz

cuongnguyenphu_0-1649122839449.png

 



It’s Run System Clock Frequency (Hz) (dynamic range)  attribute in MCU (/Mcu/McuModuleConfiguration/McuClockSettingConfig/McuRunClockConfig/McuSystemClockFrequency)
This attribute corresponds by Run System Clock Select. So you can modify these attributes to get value 40Mhz
For more information, you can check Reference Manual doc Chapter 27, Table 27-9. Peripheral module clocking to know about Clock source select for FTM:
 

cuongnguyenphu_1-1649122839515.png

In case you want to keep Source clock is SPLL, you can change  GPT FTM channel clk src to External clock

cuongnguyenphu_2-1649123071953.png

 

 

0 Kudos
Reply

1,706 Views
cuongnguyenphu
NXP Employee
NXP Employee

Hi @YoussefGhorab , can you give us version of MCAL you're using and the project's config folder also, I will try to check it from my side

0 Kudos
Reply