0
\$\begingroup\$

I want to measure the frequency of the pwm signal I will be receiving at a certain I/O pin. The issue is, I could not find any library or code written for this board. I could find this library for arduino known as FreqMeasure Library:

https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

The microcontroller used on this board is ATSAMD21 Cortex M0. Which means the register and the whole working is quite different from the arduino Atmegas.

Will I have to program from the ground up changing the register names in the original freqmeasure.h library to the ones for ATSAMD21 Cortex M0?

Or can please someone suggest any other way of doing this without having to understand this microcontroller at ground level. I am using Arduino IDE for programming the adafruit feather.

\$\endgroup\$
2
\$\begingroup\$

The Feather is Arduino Zero compatible (at least it uses the same processor) and can use the Arduino IDE for development and compiler. The code you have for FreqMeasure is written for Arduino so it should be basically the same 'C' code for the new variant of Arduino.
You may have to tweak pin numbers and if there is any inline assembler, convert that to ARM code, but the bulk of the 'C' code should be identical.

You might start reading here: https://www.arduino.cc/en/Guide/ArduinoZero

\$\endgroup\$
0
\$\begingroup\$

Assuming you are dealing with a digital input - pulse train with sufficient swing, it is not hard to build a freq counter, just a counter controlled by a time base.

There are tons of such examples.

Building your afe that works under a wide range of conditions can be difficult, for a novice.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.