Hi,
Apparently you did not read datasheet, application notes, design examples. Even video tutorials are available for
* frequency setup for PWM
* pulse counting with hardware timer/counter periferal.
Do this first.
The use code from the examples and modify them for your needs or writethe code on your own.
Test it
And if it does not work, then
* give a link to the document(s)
* show your code, maybe schematic, too
* explain what you expect
* explain what does not work as expected
Klaus