Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: FreqMeasure Lib @ Arduino MKR Zero?

  1. #1
    Junior Member
    Join Date
    Jun 2020
    Posts
    4

    FreqMeasure Lib @ Arduino MKR Zero?

    Hi.
    Is there any way to get the super cool FreqMeasure library working on the Arduino MKR Zero (Cortex-M0, 32 Bit, SAMD21) ?

    I would like to measure near (EMF/HF) fields via an antenna and it worked very well on the Arduino Nano. I still have Teensy 3.6 here too, but the library (FreqMeasure) doesn't run with it.
    Arduino IDE error: capture_read' was not declared in this scope
    capture = capture_read();

    FreqCount and FreqMeasureMulti library works.
    However, FreqCount AND FreqMeasureMulti does not measure like FreqMeasure. That's why it become "uninteresting".

    I wanted to have a controller with SD card and I2S. That's why I took the MKR Zero now.
    Maybe someone can help me to find a suitable frequency measurement library

    Greeting
    Tim

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,176
    Not sure why it is not compiling on T3.6, the sample Serial_Output does.

    So maybe you are running a real old version before T3.6? Or you edited the FreqMeasureCapture.h file and none of the pins under
    section:
    Code:
    // Teensy 3.1, 3.2, 3.5, 3.6
    #elif defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
      #define CAPTURE_USE_FTM1_CH0 3    // FTM1 CH0 is pin 3
      //#define CAPTURE_USE_FTM1_CH1 4  // FTM1 CH1 is pin 4
      //#define CAPTURE_USE_FTM2_CH0 32 // FTM2 CH0 is pin 32 (Teensy 3.1 and 3.2)
      //#define CAPTURE_USE_FTM2_CH1 25 // FTM2 CH1 is pin 25 (Teensy 3.1 and 3.2)
      //#define CAPTURE_USE_FTM2_CH0 29 // FTM2 CH0 is pin 29 (Teensy 3.5 and 3.6)
      //#define CAPTURE_USE_FTM2_CH1 30 // FTM2 CH1 is pin 30 (Teensy 3.5 and 3.6)
    Is defined and/or is valid for T3.6

    As for MKR Zero no idea. As for good library to use for it, maybe ask on Arduino Forum.

  3. #3
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    That was it. It works now!
    Nothing in my library got up after 3.1. Copy your lines into it and now it works!
    But I had installed the latest Teensyduino version and also the FreqMeasure library from here: https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

    Where else can you get the official FreqMeasureCapture.h?
    Many thanks for the quick help

  4. #4
    Junior Member
    Join Date
    Jun 2020
    Posts
    4
    Wouldn't it also be possible to use the Arduini MKR Zero and other controllers by editing?

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,176
    Quote Originally Posted by Wambo6k View Post
    That was it. It works now!
    Nothing in my library got up after 3.1. Copy your lines into it and now it works!
    But I had installed the latest Teensyduino version and also the FreqMeasure library from here: https://www.pjrc.com/teensy/td_libs_FreqMeasure.html

    Where else can you get the official FreqMeasureCapture.h?
    Many thanks for the quick help
    The library installs with Teensyduino. So for example, on mine the current IDE1 location is at: C:\arduino-1.8.19\hardware\teensy\avr\libraries\FreqMeasure
    The actual up to date version of the library is up on github: https://github.com/PaulStoffregen/FreqMeasure

    and that file is under the util directory: https://github.com/PaulStoffregen/Fr...asureCapture.h

    Quote Originally Posted by Wambo6k View Post
    Wouldn't it also be possible to use the Arduini MKR Zero and other controllers by editing?
    Most anything is possible.

    But I don't know, how hard it would be to do. As I mentioned, you might have better luck asking up on Arduino Forum, as that is the forum to support the Arduino
    products like the MKR zero. Where most of us up here are more geared toward PJRC products. This one is sort of a gray area as it is one of PaulStoffregen (an owner of PJRC) libraries.

    So, if you do get it working, you might try submitting a github Pull Request. Not sure if he will merge it or not, but worth the try.

    Good luck

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,118
    Quote Originally Posted by Wambo6k View Post
    Wouldn't it also be possible to use the Arduini MKR Zero and other controllers by editing?
    Really depends on the scope of words possible and editing.

    Deep knowledge of the SAMD timers (which I do not have) would be needed to add all the hardware abstraction defines. It's theoretically possible on hardware which has 16 bit timers with input capture feature, but getting it working is harder than it looks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •