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

Thread: Encoder loosing counts

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

    Encoder loosing counts

    Hello,
    I have setup with teesny 4.1, Chinese linear encoder and 32x8 matrix based on max7219.
    I use teensy Encoder library.
    When I use basic example (without any other library) encoder works like a charm, but as soon as I add MD_Parolalibrary and call begin method, encoder starts skipping counts (even with ENCODER_OPTIMIZE_INTERRUPTS enabled).
    I also tried to use this matrix without MD_Parola, just with MD_MAX72xx (Eyes example), but it still skips counts, less frequently though.
    32x8 matrix connected to hardware SPI pins (10, 11, 13) and setup as hardware SPI with both libraries, I also tried as software SPI, but result is the same.
    Encoder connected through level converter (TXS0108E) to pins 22 and 23.

    What am I doing wrong and how to solve it?

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,057
    Did you try this library https://github.com/mjs513/Teensy-4.x...ncoder-Library from mjs513? It uses hardware timers which should be more immune to interference from other libs.

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    331
    Quote Originally Posted by addast View Post
    Hello,
    I have setup with teesny 4.1, Chinese linear encoder and 32x8 matrix based on max7219.
    I use teensy Encoder library.
    When I use basic example (without any other library) encoder works like a charm, but as soon as I add MD_Parolalibrary and call begin method, encoder starts skipping counts (even with ENCODER_OPTIMIZE_INTERRUPTS enabled).
    Can you rule out interference - switching lots of LEDs generates EMI and if the wires run close together this might be an
    issue. If the encoder only uses weak pullups try adding 1k or 2k2 physical pull ups on the encoder lines to stiffen them
    up against cross-talk.

  4. #4
    Junior Member
    Join Date
    Jul 2020
    Posts
    4
    Thanks you, this library solved my problem.

Posting Permissions

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