Hello,
I want to implement a simple 16-bit freerunning counter using RealTime Drivers (RTD) but I cannot find the proper functions here. In the SDK there are the functions FTM_DRV_InitCounter, FTM_DRV_CounterStart, FTM_DRV_CounterStop, FTM_DRV_CounterRead, ... but I cannot find equivalent functions in the RTD set. Additionally I need a function to reset the counter value like provided by FTM_DRV_SetCounter in the SDK.
Any help/example is greatly appreciated.
Best Regards,
Solved! Go to Solution.
The functions that can be realized by these SDKs are exactly the same.
I don't know how you used the FTM module to achieve the function in the old version, but it is sure that the RTD driver can also be implemented,
I checked the "Ftm_Gpt_Ip.c" file, which is the same as the "ftm_mc_driver.c" provided by RTM almost the same function
please take a look at the demo "Ftm_Gpt_Example_S32K144" in S32 DS
I attached the example description for you know.
1. Example Description
The application includes a Design Studio project, that uses predefined configurations for the IP layer only (Port_Ci, Clock, IntCtrl, Ftm and Osif).
The application uses the IP layer functionality to trigger a timer interrupt. Notification function increase a count variable by 1 and toggle state pin LED on board.
1.1 The application software functionality
- Clock_Ip_Init
Initializes the clock
- Port_Ci_Port_Ip_Init
Initializes the pins used by the application using the Port_Ci API.
- IntCtrl_Ip_EnableIrq & IntCtrl_Ip_InstallHandler
Enable the interrupt used by the application and set the correct handler for it.
- Ftm_Gpt_Ip_Init, Ftm_Gpt_Ip_InitChannel, Ftm_Gpt_Ip_EnableChannelInterrupt & Ftm_Gpt_Ip_StartTimer
Initialize the Ftm IP layer, to start the selected timer and to enable its notification that will be used for periodically blinking an LED
- Runs the while(1) loop and, based on the Ftm notification, uses the Gpio_Dio_Ip_TogglePins of the Gpio_Dio IP API to toggle the pin connected to the LED
I know this example but unfortunately I don't think that this example fits for me.
I want to generate a time base (microseconds, freerunning). So generating an interrupt (every microsecond) is not an option for me. I wonder because the the counter functionality was included in the previous SDK.
The functions that can be realized by these SDKs are exactly the same.
I don't know how you used the FTM module to achieve the function in the old version, but it is sure that the RTD driver can also be implemented,
I checked the "Ftm_Gpt_Ip.c" file, which is the same as the "ftm_mc_driver.c" provided by RTM almost the same function