Skip to content

Cross post: Weird Behavior ObjectFLED with Teensy Audio Library #2

Closed

Description

@zackees

Please follow the discussion here:

FastLED/FastLED#1818

Activity

  1. zackees commented on Dec 29, 2024

    @zackees
    ContributorAuthor

    Here's a video clip of the flicker. He has a lot of other DMA devices going on at the same time so this could be the cause. I'm asking him to isolate the project so that it just does fastled rendering and nothing else.

    It kind of worked, as the fps jumped from 43 (plain FastLED) to 133 (the same I get with WS2812Serial), but there some issues, like random pixels flickering all the time (see video).

  2. changed the title [-]Cross post: Weird behavior of v3.9.8 on Teensy 4.x with ObjectFLED driver [/-] [+]Cross post: Weird Behavior ObjectFLED with Teensy Audio Library[/+] on Jan 1, 2025
  3. KurtMF commented on Jan 1, 2025

    @KurtMF
    Owner

    Test code from @lpaolini:

    `#include <FastLED.h>
    #include <ObjectFLED.h>
    #include <Audio.h>

    #define PIN 17
    #define NUM_LEDS 192

    CRGB leds[NUM_LEDS];
    uint8_t pinList[1] = {PIN};
    ObjectFLED fled(NUM_LEDS, leds, CORDER_GRB, 1, pinList);
    AudioInputI2S audioInput;

    void setup() {
    fled.begin();
    }

    void loop() {
    fled.show();
    delay(10);
    }
    `

    Testing showed that FastLED is not the cause. It is DMA and/or timer conflict between ObjectFLED and Audio.h. Likely the conflict is inherited from OctoWS2811 library.

    Investigating...

  4. KurtMF commented on Jan 1, 2025

    @KurtMF
    Owner

    @lpaolini, When you installed Audio library, did you grab the master, updated 2 years ago, or did you install the "latest" release updated 2015?

  5. lpaolini commented on Jan 2, 2025

    @lpaolini

    Installed from the GitHub repo, so it ought to be master.

    lib_deps =
        https://github.com/PaulStoffregen/Audio
        fastled/[email protected]
    

    By the way, why "2 years ago"? Master has been updated several times in 2024.

  6. KurtMF commented on Jan 2, 2025

    @KurtMF
    Owner

    Happy New Year! I've reproduced this error and ruled out OctoWS2811 and FastLED as the cause. Apparently I introduced this error in ObjectFLED when I re-packaged the DMA driver code from OctoWS2811. So my PD is focused on this, and any differences I inadvertently introduced while refactoring OctoWS2811 code.

    The conflict can be eliminated by commenting out this single line of code from the Audio library file output_i2s.cpp:

    [CODE]393 CCM_CCGR5 |= CCM_CCGR5_SAI1(CCM_CCGR_ON);[/CODE]

    This is executed by the constructor for AudioInputI2S. I can't see any direct conflicts between this and ObjectFLED's use of quad timer, but I'm not expert in register-level hardware. Investigation continues. I didn't think I changed anything in OctoWS2811 DMA and timer configuration when I converted it to ObjectFLED. But I will dig deeper into this.

  7. zackees commented on Jan 2, 2025

    @zackees
    ContributorAuthor

    @KurtMF can you file an issue with Pauls Audio library and explain that we are investigating this issue and your potential fix to see what he has to say?

    https://github.com/PaulStoffregen/Audio/issues/new

  8. KurtMF commented on Jan 3, 2025

    @KurtMF
    Owner

    I don't think that will be necessary. Paul made contact with us here and Audio library isn't the one with the issue. Nor is OctoWS2811, the grandfather of ObjectFLED.

    Apparently, I broke something when I refactored Octo to work in multiple objects. I'm determined to get to the bottom of it today.

  9. KurtMF commented on Jan 4, 2025

    @KurtMF
    Owner

    YAY! Problem solved. Details here.

    @lpaolini, can you please give confirmation for this fix? To confirm, use the last test code from above, where you operated with ObjectFLED raw, declaring an ObjectFLED object, but use begin(1.2); instead of begin(); for overclocking?

    Also this should work (with no overclocking):
    begin(1.0, 1250, 300, 750, 75);

    Thanks!

  10. self-assigned this
    on Jan 4, 2025
  11. lpaolini commented on Jan 4, 2025

    @lpaolini

    @KurtMF Yes, confirmed! They both work.

    Thanks for looking into this issue.

  12. KurtMF commented on Jan 4, 2025

    @KurtMF
    Owner

    Excellent. Thank you also, @lpaolini, for helping me home in on this.

    I'm going to change the hard-coded default values in ObjectFLED so this all works out of the box.

  13. lpaolini commented on Jan 4, 2025

    @lpaolini

    How about ObjectFLED via FastLED? Would the following be enough for fixing the issue?

    #define FASTLED_OVERCLOCK 1.2
    
  14. zackees commented on Jan 4, 2025

    @zackees
    ContributorAuthor

    How about ObjectFLED via FastLED? Would the following be enough for fixing the issue?

    Yes, it binds to the overclock factor passed into ObjectFLED so it should work great. Let me know if it doesn't, as it would be a bug.

  15. lpaolini commented on Jan 4, 2025

    @lpaolini

    Hmm... I've just tried on my test sketch and it doesn't seem to work.

  16. 4 remaining items

  17. KurtMF commented on Jan 4, 2025

    @KurtMF
    Owner

    @KurtMF I'm at the 1.0.2 of your codebase. Do I need to rebase to 1.0.3? Would that have anything to do with

    I wouldn't do that just yet, I have confidence it will work with the right define label.

    1.1.0 should be out by Monday with default values fixed for this.

  18. zackees commented on Jan 4, 2025

    @zackees
    ContributorAuthor

    Good point. Others have made the same mistake of using #define FASTLED_OVERCLOCK.

    I've changed it in master. Both will work and now you will get a compiler message indicating the FASTLED_OVERCLOCK is now active until you actively suppress the message with #define FASTLED_OVERCLOCK_SUPPRESS_WARNING.

  19. KurtMF commented on Jan 4, 2025

    @KurtMF
    Owner

    #define FASTLED_OVERCLOCK
    #define FASTLED_OVERCLOCK_SUPRESS WARNING
    #define FASTLED_LED_OVERCLOCK
    #define FASTLED_LED_OVERCLOCK_IGNORE_SUPRESS_WARNING
    #define FASTLED_LED_OVERCLOCK_NEED_MORE_DEFINES_PLEASE
    #define FASTLED_LED_OVERCLOCK_ZACK_MAGIC
    #define FASTLED_LED_OVERCLOCK_:-)

  20. lpaolini commented on Jan 4, 2025

    @lpaolini

    Good point. Others have made the same mistake of using #define FASTLED_OVERCLOCK.

    Alright, then the release notes for v3.9.8 should be fixed, I guess.

  21. lpaolini commented on Jan 4, 2025

    @lpaolini

    Ok, I tested again my test sketch using FASTLED_LED_OVERCLOCK and it works, yay!

    However, I've also tried replacing WS2812Serial with ObjectFLED driver in my library and I can't get a single overclock factor satisfying all my 4 strips at the same time (e.g. 20% overclock works for my newer 144 LED/m, but it doesn't for the older 60LED/m strips), while using WS2812Serial all strips work perfectly well.

  22. KurtMF commented on Jan 5, 2025

    @KurtMF
    Owner

    Hmm. I would try the following, in order, to get all working:

    • .begin(1.2, 350); // extra long latch delay since I've read some old LEDs require 300 uS
    • .begin(1.0, 1250, 300, 750, 350); //combines long latch delay, no overclock solution

    ObjectFLED is optimized for performance! If you want to drive old clunkers with it , ya gotta slow it down. :-)

  23. zackees commented on Jan 5, 2025

    @zackees
    ContributorAuthor

    Good point. Others have made the same mistake of using #define FASTLED_OVERCLOCK.

    Alright, then the release notes for v3.9.8 should be fixed, I guess.

    Thanks

  24. zackees commented on Jan 5, 2025

    @zackees
    ContributorAuthor

    Hmm. I would try the following, in order, to get all working:

    • .begin(1.2, 350); // extra long latch delay since I've read some old LEDs require 300 uS
    • .begin(1.0, 1250, 300, 750, 350); //combines long latch delay, no overclock solution

    ObjectFLED is optimized for performance! If you want to drive old clunkers with it , ya gotta slow it down. :-)

    In FastLED this would be

    ObjectFled::SetLatchDelay(uint16_t)
  25. zackees commented on Jan 5, 2025

    @zackees
    ContributorAuthor

    @KurtMF might be a good idea to use the 250 uS delay that the new WS2812-V5B uses.

    I've increased the latch delay to be the default FastLED on master.

  26. lpaolini commented on Jan 5, 2025

    @lpaolini

    ObjectFLED is optimized for performance! If you want to drive old clunkers with it , ya gotta slow it down. :-)

    Haha! True, but I'm not a big fan of overclocking when it puts stability at a risk. For massive performance gain, more than stretching the specs to the limits, I would just drop WS2812 and go all in with APA102 or other synchronous LED chip.

    Perhaps next version of ObjectFLED will handle 39/54 parallel outputs, with one reserved for a single shared clock... :-)

  27. zackees commented on Jan 5, 2025

    @zackees
    ContributorAuthor

    HD107s for the win

  28. lpaolini commented on Jan 5, 2025

    @lpaolini

    Well, HD108 then :-)

  29. KurtMF commented on Jan 5, 2025

    @KurtMF
    Owner

    @KurtMF might be a good idea to use the 250 uS delay that the new WS2812-V5B uses.

    I've increased the latch delay to be the default FastLED on master.

    Yes, you guys are both right: I set the default timings too aggressive, and we have seen the result. After talking with Paul S. and doing some more testing I set default Latch Delay = 300 uS.

    I also changed defaults for TH_TL, T0H, and T1H to fix the Audio lib problem.

    Now... I think there's a way to close this issue and tie it to the latest release: 1.1.0

  30. zackees commented on Jan 6, 2025

    @zackees
    ContributorAuthor

    Cool, I changed it master to also be 300 uS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions