Jul 28, 2020
04:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jul 28, 2020
04:55 AM
Hi,
I'm trying to configure GMT timer.
The problem is that, result frequency is different than the one i set.
I have following init function:
I also use timer interrupts.
The problem is, that the frequency of setting/resenting is complettly different than the one i set.
if I set timerConfig.base.frequency = 100 (Hz) which is 10 ms period, interrupt is firing in 450 us period (2.2 kHz).
If I set timerConfig.base.frequency = 1000(Hz) which is 1ms, interrupt is firing in 45 us period (22.2 kHz).
As source I use PLL that is ramped-up to 133.33 MHz, f_source = 133.33 MHz.
f_GTM = f_ source
Why GTM timer is setting completely different frequency than those configured?
I work on Tc222L
I'm trying to configure GMT timer.
The problem is that, result frequency is different than the one i set.
I have following init function:
void gtm_timers_initialization(void){
boolean interruptState = IfxCpu_disableInterrupts();
/* set Gtm clock frequency */
float32 gtm_frequency = IfxGtm_Cmu_getModuleFrequency(gtm);
IfxGtm_enable(gtm);
IfxGtm_Cmu_setGclkFrequency(gtm, gtm_frequency);
IfxGtm_Tom_Timer_Config timerConfig;
IfxGtm_Tom_Timer_initConfig(&timerConfig, gtm);
/* power switch timer */
timerConfig.base.frequency = 100; //100Hz
timerConfig.base.minResolution = (1.0/timerConfig.base.frequency)
/TIMER_RESOLUTION_DIVIDER;
timerConfig.base.isrProvider = ISR_PROVIDER(INTERRUPT_TIMER_10MS);
timerConfig.base.isrPriority = ISR_PRIORITY(INTERRUPT_TIMER_10MS);
timerConfig.base.trigger.enabled = FALSE;
timerConfig.tom = IfxGtm_Tom_0;
timerConfig.timerChannel = IfxGtm_Tom_Ch_0;
timerConfig.clock = IfxGtm_Tom_Ch_ClkSrc_cmuFxclk0;
IfxGtm_Tom_Timer_init(&tom_timer, &timerConfig);
IfxCpu_restoreInterrupts(interruptState);
IfxGtm_Cmu_enableClocks(gtm,
IFXGTM_CMU_CLKEN_FXCLK | IFXGTM_CMU_CLKEN_CLK0);
IfxGtm_Tom_Timer_run(&tom_timer);
}
I also use timer interrupts.
IFX_INTERRUPT(ISR_Timer_10ms, 0, ISR_PRIORITY_TIMER_10MS){
if(switch_timer % 2 == 0){
switch_on_pin();
}else{
switch_off_pin();
}
switch_timer++;
}
The problem is, that the frequency of setting/resenting is complettly different than the one i set.
if I set timerConfig.base.frequency = 100 (Hz) which is 10 ms period, interrupt is firing in 450 us period (2.2 kHz).
If I set timerConfig.base.frequency = 1000(Hz) which is 1ms, interrupt is firing in 45 us period (22.2 kHz).
As source I use PLL that is ramped-up to 133.33 MHz, f_source = 133.33 MHz.
f_GTM = f_ source
Why GTM timer is setting completely different frequency than those configured?
I work on Tc222L
- Tags:
- IFX
1 Reply
Aug 04, 2020
06:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Aug 04, 2020
06:33 AM
Problem solved,
It turns out tha iLLD library supports only 100,200 Mhz frequencies. Setting every different result in shitty GTM timer frequency.
Moreover GTM module is doubling input frequency, if ones want to have fGtm = 100 MHz, they must provide 50 Mhz frequency ( GTMDIV = fsource/2).
It turns out tha iLLD library supports only 100,200 Mhz frequencies. Setting every different result in shitty GTM timer frequency.
Moreover GTM module is doubling input frequency, if ones want to have fGtm = 100 MHz, they must provide 50 Mhz frequency ( GTMDIV = fsource/2).