Hello,
How to configure a timer interrupt to fire each 5 ms seconds?
I am using this configuration:
But the timer interrupt fires every 0.000223 seconds.
Thanks in advance,
Your,
Abdelrhman
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
How to configure a timer interrupt to fire each 5 ms seconds?
I am using this configuration:
But the timer interrupt fires every 0.000223 seconds.
Thanks in advance,
Your,
Abdelrhman
Hello,
In order to configure 5ms,
Clock frequency is taken as 200MHz and the preload value as 1 which defines,
Tick frequency as (Clock frequency/ (1+Preload value))
So, tick frequency becomes 200MHz/ (1+1) = 200MHZ/2 = 100MHz = 10nanoseconds
So, to fire timer interrupt every 5 ms, timer should count up to 5ms/10ns, i.e.,500000 times.
Hello,
Thanks for your help, what is the register to put the 500000 value inside?
Hello,
You can put it in tick frequency section in your configuration. Below i have provide a sample reference through which you can predict.
Hello,
I don't want to use the GPT, I want to user the timer peripheral direct.
Hello,
If you want under timer peripherals, then under compare upcounter assign 500000 and free running counter shall be 1.
Hello,
you can find user guide here 4.12. GPT — Platform MCAL Development - AM263 User Guide (ti.com)
Hello,
I used the suggested value by your side and still not working every 5 ms
The user guide does not contain any examples of configuring a timer.
Could you guide me with all the needed steps and registers?
Hi Afifi,
May I know the reason why you do not want to use MCAL GPT driver?
Thanks And Regards,
Sunil Kumar M S
Hello,
My code footprint is too small so I cannot add any AUTOSAR module.
On the other hand, the documentation of the user guide should contain an example or pseudo code regarding the integration steps.
I followed the suggested implementation from your colleague (which was wrong from the beginning).
The function Gpt_StartTimer shall start the selected timer channel with the defined target time, not add the target time as a Prescaler.
The Gpt can count the defined timer using any prescaler.
I need the integration steps to integrate a timer to count 5 ms using the registers directly without the Gpt.
The SDK doesn't contain Gpt so it should be integrated there.
Yours,
Abdelrhman Afifi
Hi Afifi,
Are you expecting SDK RTI driver which normally has register level APIs to integrate timer module and not MCAL?
Is your usecase not in AUTOSAR context?
Thanks And Regards,
Sunil
Hello Kumar,
I am using the MCAL, I was highlighting that the timer module should be integrated with your SDK already.
So it is not a big challenge to illustrate the steps to configure it.
Yes, I will integrate the timer by using the MCAL based on register-level APIs, if could kindly provide me with the steps to follow and the needed register values I will do it inside my API.
I tried to configure it here
I am using this configuration:
But the timer interrupt fires every 0.000223 seconds.
But it was not working as expected.
Thanks for your help.
Hi Afifi,
Unfortunately, MCAL does not have register level api's to use timer module as it is not in the scope.
Can you refer below documentation in SDK and build this example?
software-dl.ti.com/.../EXAMPLES_DRIVERS_RTI_LED_BLINK.html
Please refer "Drivers_rtiOpen" api in generated\ti_drivers_open_close.c which has register level api's to configure timer.
Thanks And Regards,
Sunil Kumar M S
Hi Kumar,
Okay, but at least the user guide should contain integration steps to configure the timer. I will implement my APIs but I need to know the follow inside the registers.
I can not find this in the user manual so this is a lack of documentation, where it is supposed to find the integration steps?
I will look into this example.
Thanks
Hi Afifi,
I will take this input and file an internal ticket. We will improve our GPT documentation w.r.o integration steps
Thanks And Regards,
Sunil Kumar M S
Hello Kumar,
It is related to the SOC user manual itself, not GPT only.
Thanks for your time and support.
Hello
I have suggested as per Autosar context. Since you need bare metal context, as your code footprint is quite small,you can refer RTI module of mcu plus sdk package for further clarification.
Regards,
Baishnavi
Hi Afifi,
I have created internal ticket to update SOC user manual. It will be updated in future release of TRM.
SMCUAPPS-747:AM263x TRM Refinement - Timers
Thanks And Regards,
Sunil Kumar M S