I have an application which needs to determine the frequency of a signal using a S7G2-DK and SSP1.1.3. This can be done with an interrupt keeping track of pulses for a given period of time. It looks like the AGT module has a mode where it can count external events. I added g_timer Timer Driver on r_agt to the HAL/Common thread. When configuring the timer Mode, there are only options for one-shot and periodic. Then I checked the Pins/Peripherals and in Operation Mode there is an Event Counter.
My questions: Would using the AGT be a way to determine the frequency of a signal? Any advice on setting it up?
Consider using a GPT timer. These are 32-bit timers so will give you greater frequency range and resolution.
By using the input capture feature the GPT hardware will automatically measure your input waveform.
The frequency is the GPT timer frequency (PCLKA) divided by the Input Capture timer value.
By default the Input Capture module only does pulse width measurement, whereas you require pulse period measurement.
However, it is possible to reconfigure the GPT Input Capture module.
Please see my attached project that uses "direct register" access to reconfigure the GPT registers.
I wrote this for a SK-S7G2, and use GPT7 as GTIOCA on Port 3.4 was easily accessible.
You can port this to whichever GPT channel you wish by changing the code to the appropriate registers etc.
Hope this helps.