RMT based NeoPixels (WS2812B) flickers when WiFi is used

tltltl
Posts: 6
Joined: Mon Dec 18, 2017 1:49 pm

Re: RMT based NeoPixels (WS2812B) flickers when WiFi is used

Postby tltltl » Mon Oct 22, 2018 7:34 am

This problem sadly never got resolved.
We tried many different things. We used different pieces of SW, different libraries, different approaches (RMT, separate pinned task, etc).
As far as we could tell, we couldn't make any progress except that some approaches flickered a bit more and some a bit less.

An interesting fact is, that we use multiple identical devices and IF it flickers, it flickers on all of them in the exact and identical pattern. ESP32 rev0 vs rev1 didn't make a difference either.
Also we investigated the signal and we're certain that, the RMT-signal comes out scrambled on the level of ESP. So we're certain that the flickering isn't because of our HW.

We're certain as well that it correlates with WiFi. If not using WiFi we *never* had any issue. If using WiFi (regardless of what: udp, tcp, sta, ap, etc) the issues randomly appears.

I'd really appreciate it, if you could post any news you find along the way - maybe I can try some of your approaches as well and I'm happy to answer any question you may have...:-)

cheers!

ESP_Sprite
Posts: 2069
Joined: Thu Nov 26, 2015 4:08 am

Re: RMT based NeoPixels (WS2812B) flickers when WiFi is used

Postby ESP_Sprite » Tue Oct 23, 2018 2:37 am

Is there any chance you can build a minimal application that shows this issue, so we can reproduce it easily?

cranphin
Posts: 5
Joined: Mon Apr 02, 2018 12:31 pm

Re: RMT based NeoPixels (WS2812B) flickers when WiFi is used

Postby cranphin » Tue Oct 30, 2018 5:02 pm

Right, I think I actually fixed my problem..
I created the interrupt handler (rmt_driver_install for RMT, digitalLeds_initStrands for the WS2812 library) from the main task (app_main), which apparently defaults to being on core 0. This also makes the interrupt handler being handled on core 0 (as documented on https://docs.espressif.com/projects/esp ... ore-issues).

Changing things so that the interrupt handler is created from core 1 seems to solve my issue! :) Still testing though.

nokeyboard
Posts: 1
Joined: Sat Dec 08, 2018 10:28 pm

Re: RMT based NeoPixels (WS2812B) flickers when WiFi is used

Postby nokeyboard » Sat Dec 08, 2018 11:10 pm

Hello!

I have the same issue - ws2812b pixels glitches when wifi transferring data.

I've tried use another core following the advice given by @cranphin but no success.

There is my part of code for leds. It makes simple rainbow effect. And when esp32 transferring data pixels start flickers with wrong colours. I use this lib for pixels: https://github.com/FozzTexx/ws2812-demo.

Code: Select all


....
wifi logic
....

void strip_init();
void app_main(void) {
    // Initialize NVS
    esp_err_t ret = nvs_flash_init();
    if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }
    ESP_ERROR_CHECK( ret );

    wifi_init();
    wifi_remote_control_init();
    strip_init();
}


#define WS2812_PIN  18
#define LED_COUNT 132            // this is the number of WS2812B leds on the strip
#define delay_ms(ms) vTaskDelay((ms) / portTICK_RATE_MS)

// rgbVal pixels[LED_COUNT];

void rainbow(void *pvParameters)
{
  const uint8_t anim_step = 10;
  const uint8_t anim_max = 100;
  const uint8_t pixel_count = LED_COUNT; // Number of your "pixels"
  const uint8_t delay = 25; // duration between color changes
  rgbVal color = makeRGBVal(anim_max, 0, 0);
  uint8_t step = 0;
  rgbVal color2 = makeRGBVal(anim_max, 0, 0);
  uint8_t step2 = 0;
  rgbVal *pixels;


  pixels = malloc(sizeof(rgbVal) * pixel_count);
  memset(pixels, 0, sizeof(rgbVal) * pixel_count);

  while (1) {

    color = color2;
    step = step2;

    for (uint8_t i = 0; i < pixel_count; i++) {
      pixels[i] = color;

      if (i == 1) {
        color2 = color;
        step2 = step;
      }

      switch (step) {
      case 0:
        color.g += anim_step;
        if (color.g >= anim_max)
          step++;
        break;
      case 1:
        color.r -= anim_step;
        if (color.r == 0)
          step++;
        break;
      case 2:
        color.b += anim_step;
        if (color.b >= anim_max)
          step++;
        break;
      case 3:
        color.g -= anim_step;
        if (color.g == 0)
          step++;
        break;
      case 4:
        color.r += anim_step;
        if (color.r >= anim_max)
          step++;
        break;
      case 5:
        color.b -= anim_step;
        if (color.b == 0)
          step = 0;
        break;
      }
    }

    ws2812_setColors(pixel_count, pixels);

    delay_ms(delay);
  }
}

void on_cpu_1(void *pvParameters) {

    printf("Init on CPU 1\n");

    ws2812_init(WS2812_PIN);
    xTaskCreate(rainbow, "ws2812 rainbow demo", 4096, NULL, 10, NULL);
    vTaskDelete(NULL);
}

void strip_init() {
    printf("Start strip\n");
    nvs_flash_init();

    xTaskCreatePinnedToCore(on_cpu_1, "on_cpu_1", 4096, NULL, 10, NULL, 1);
}



I'm new to using esp32 and RTOS and I will be grateful for any answer and the more detailed the better.

Thanks!

Who is online

Users browsing this forum: No registered users and 15 guests