WS2812 (NeoPixel) Multi Pin Write Issue

Posted on
  • So I'm driving two different NeoPixel rings from an ESP32 module. They are on different pins. One is a 16 pixel ring, the other is a 24 pixel ring. I understand they can be chained together, however for various reasons this is not my setup.

    Basically the problem is that when I write to one Neopixel ring on one pin, using Espruino 1v97, it writes to all the other rings on other pins. I've tried this with up to three rings on three different pins, on several different ESP32 modules. I am using 1v97, as it seems to be the last module supporting WS2812's.

    I would like to point out that I have used this setup many times on the ESP8266 and it worked perfectly fine, and I replicated this today just to convince myself. It seems like something that would be an electrical problem, except I've used several different kinds of boards (LinLo, Heltec, WeMos, etc, etc), and the commonality is always the ESP32. The 8266 boards work fine.

    Below is the setup and information needed to reproduce if interested.

    I have included my wiring diagram -- it can't get more simple then that. Its the same for both the ESP32s and the 8266s.

    So take some simple code like this:

    // WS2812 TEST
    
    var neopixel=require("neopixel");
    
    // reset the rings, not needed actually
    pixels24=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,­0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,­0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,­0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,];
    pixels16=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,­0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,­0,0,0,0,0,0,0,0,0,0,0,0,0,];
    
    pinMode(D12,"output");
    pinMode(D14,"output");
    
    neopixel.write(D12,pixels16);
    neopixel.write(D14,pixels24);
    
    neopixel.write(D12,[100,0,100,100,0,100]­);
    neopixel.write(D14,[10,100,50,10,100,50]­);
    
    

    We would expect that at the end of this code the ring on D12, would have two pixels different than the ring on D14 (yes I tried different pins).

    On the ESP32 both rings always end up in the same state with the same color. On the ESP8266 modules the rings always end up different colors as you would expect.

    I saw there is an open GitHub ticket for WS2812 which seems to have broken since moving to IDF 3.xx, but I wasn't sure if its related as it seems to be an issue on 1v97. I did not have the time to check on earlier versions.

    I'd just like to point out that 1v97 works perfectly fine for one array of NeoPixels on one pin. So if any one is able to reproduce this, and or has any ideas that would be helpful, it would be appreciated.

    It would be a strange bug in my mind that it would simply affect all NeoPixels on any pins. As I said, I've done multi-ring setups on the ESP8266 (in fact its quite common, as I do NeoPixel lighting for some projects), and I've not seen this issue ever before there.

    Thanks!

    (Just for fun I included photos from my tests today so you see what I mean in case it wasn't clear. The photo where the two rings have the same color are the ESp32s, etc...)


    3 Attachments

    • ESP32 Result.png
    • ESP8266 Result.png
    • Wiring Diagram.png
  • @JumJum wrote the neopixel code on the esp32 using the ESP-idf rmt code. It's possible that a two channels might be using the same timers and that is what is screwing it up?

  • Oh - and it really needs to be fixed for the 3.0/3.1 ESP-idf version, so that it will work with the current releases.

  • Yeah I saw that @JumJum had written the code in one of the Github tickets. I had a look at it, but its using alot of stuff I haven't figured out in the IDF (not that I've done much yet). RMT channels, etc, plus how WS2812s work in general at the protocol level. I might have a look at it over the weekend, see if I can make heads or tails of it.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

WS2812 (NeoPixel) Multi Pin Write Issue

Posted by Avatar for hungryforcodes @hungryforcodes

Actions