MsTime2, FlexiTimer2 (Udoo Neo)

Discussion in 'Arduino IDE' started by Juergen, Dec 18, 2015.

  1. Juergen

    Juergen New Member

    Joined:
    Dec 18, 2015
    Messages:
    1
    Likes Received:
    0
    Hello,

    background: I want to sample data from an analog pin at 250Hz or more. Therefore, it is very important that the data samples are being taken at exact time intervals, ie the time/gap between the individual samples are equidistant. (I am using the Olimex ECG shield [1]).

    I am trying to use the MsTimer2 [2] or FlexiTimer2 [3] library with the "Arduino" on Udoo Neo. However, both complain, that it is not an AVR [4]. After investigating the source, I noticed that there is a port to the Teensy (which also uses the Cortex M4, AFAIK).
    If I fake the Teensy (#define TEENSYDUINO) I get past the #ifdef_s in the include file, but it still complains that some interrupt class is not defined. Long story short: is there a way to make [2] or [3] work on "RTOS"??

    If not, can you think of another way to force the samples being taken at exactly the same time? I already tried the idea of checking how many milliseconds have passed, but for some reason, the "delta" between readings still seems to vary almost randomly.

    Thanks a lot!! Jürgen

    btw- really like that the Udoo Neo ADC does 14 bit instead of 12!! :)

    [1] https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/
    https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/resources/ShieldEkgEmgDemo.zip
    [2] https://github.com/PaulStoffregen/MsTimer2
    [3] https://github.com/PaulStoffregen/FlexiTimer2
    [4] https://github.com/PaulStoffregen/FlexiTimer2/blob/master/FlexiTimer2.h#L9
     

Share This Page