arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.02k stars 4.78k forks source link

ESP32 WS2812 issue #11986

Closed marc-gist closed 3 years ago

marc-gist commented 3 years ago

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.

Using the latest build (as of yesterday git pull). ESP32 ws2812 works fine. However, issuing led10 004400 or the like commands to turn on a specific Led to a specific color sometimes works, sometimes doesn't. when it doesn't work, what appears to happen is some leds turn off (don't receive correct data). usually random 1-3 leds. issuing the same command often "fixes" it, sometime just moves the off leds.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

{"Module":{"1":"ESP32-DevKit"}}

{"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"0":"None"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO12":{"0":"None"},"GPIO13":{"0":"None"},"GPIO14":{"0":"None"},"GPIO15":{"0":"None"},"GPIO16":{"0":"None"},"GPIO17":{"1376":"WS2812"},"GPIO18":{"544":"LedLink"},"GPIO19":{"288":"Led1"},"GPIO20":{"0":"None"},"GPIO21":{"640":"I2C SDA1"},"GPIO22":{"608":"I2C SCL1"},"GPIO23":{"0":"None"},"GPIO24":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO28":{"0":"None"}} {"GPIO29":{"0":"None"},"GPIO30":{"0":"None"},"GPIO31":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"0":"None"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO37":{"0":"None"},"GPIO38":{"0":"None"},"GPIO39":{"0":"None"}}

- [ ] If using rules, provide the output of this command: `Backlog Rule1; Rule2; Rule3`:
```lua
  Rules output here:
- [ ] Set `weblog` to 4 and then, when you experience your issue, provide the output of the Console log:
```lua
  Console output here:

19:02:01.669 CMD: power1 1
19:02:01.671 SRC: WebConsole from 10.2.1.2
19:02:01.673 CMD: Group 0, Index 1, Command "POWER", Data "1"
19:02:01.694 MQT: iot/tasmota/stat/tasmota_370E24/RESULT = {"POWER":"ON"}
19:02:01.699 MQT: iot/tasmota/stat/tasmota_370E24/POWER = ON
19:02:07.817 WIF: Checking connection...
19:02:10.914 CMD: led1 800000
19:02:10.916 SRC: WebConsole from 10.2.1.2
19:02:10.918 CMD: Group 0, Index 1, Command "LED", Data "800000"
19:02:10.940 MQT: iot/tasmota/stat/tasmota_370E24/RESULT = {"Led1":"800000"}
19:02:20.043 CMD: led2 800000
19:02:20.045 SRC: WebConsole from 10.2.1.2
19:02:20.047 CMD: Group 0, Index 2, Command "LED", Data "800000"
19:02:20.068 MQT: iot/tasmota/stat/tasmota_370E24/RESULT = {"Led2":"800000"}
19:02:23.415 CMD: led10 800000
19:02:23.417 SRC: WebConsole from 10.2.1.2
19:02:23.419 CMD: Group 0, Index 10, Command "LED", Data "800000"
19:02:23.443 MQT: iot/tasmota/stat/tasmota_370E24/RESULT = {"Led10":"800000"}
19:02:27.818 WIF: Checking connection...

TO REPRODUCE

Steps to reproduce the behavior:

Connect a strip of WS2812 leds (i have 16 leds) and try to set individual leds to a color.

EXPECTED BEHAVIOUR

A clear and concise description of what you expected to happen.

led changes to set color

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.

(Please, remember to close the issue when the problem has been addressed)

ascillato commented 3 years ago

Hi,

Seems to be a power supply issue. Can you use a bigger power supply and re check the wirings?

marc-gist commented 3 years ago

Hi,

Seems to be a power supply issue. Can you use a bigger power supply and re check the wirings?

I have a 3A supply, so not that :( Works fine using the FastLED library and MCP23017 in a custom code, so maybe interference/timing issue with other routines that tasmota does is my guess.

s-hadinger commented 3 years ago

Can you make sure you have defined #define USE_WS2812_RMT 0

Default configuration is to use hardware RMT channel 0. If not, it defaults to bitbang which is not reliable on ESP32 due to interrupts

marc-gist commented 3 years ago

Can you make sure you have defined #define USE_WS2812_RMT 0

Default configuration is to use hardware RMT channel 0. If not, it defaults to bitbang which is not reliable on ESP32 due to interrupts

I had that set... so that doesn't appear to be the issue. I am driving it with 3.3v data (no level shifter), but the cable is like 6 inches, and never had issues driving with 3.3v data with FastLED, or esp8266's and tasmota before.

marc-gist commented 3 years ago

I did more testing. Powered the strip from 3.3v, still have the same intermittent issues using tasmota :(

s-hadinger commented 3 years ago

I tried extensively with a M5Stack Atom that has 20 leds and the RMT version is rock solid, no glitch. However big banging has random issues (not often but still occurs). It's maybe not a timing issue, but another bug.

Do you have a logic analyzer at hand to record what is sent by the ESP32?

marc-gist commented 3 years ago

Do you have a logic analyzer at hand to record what is sent by the ESP32?

I wish... can you recommend an affordable one? I would defiantly consider getting one to help out in these instances.

From my reading. The ESP32 using NeoPixelBus should be using the RMT method on the dev kit. What pin does the Atom use for the WS2812 (I'll look up and see if that changes anything)... Also could be that they use the 2812C, where I think mine are generic or 2812B.

marc-gist commented 3 years ago

Doing more testing. Got a fresh WS2812B strip factory ends etc, just to make sure. Tasmota on 3 different ESP32 from 3 different manufactures (D1 ESP32, TTGO Esp32, generic Dev4 board). All exibit the same behaviour, with and without a level shifter (74AHCT125).

Here is my custom compile config

#ifndef _USER_CONFIG_OVERRIDE_H_
#define _USER_CONFIG_OVERRIDE_H_

// Shrink Bin Size; good for bulbs
// remove things like web timer editing, 
//    sunrise, shelly dimmer, sonoff rf, web server advertise
//#define SHRINK

// ENABLE custom sensor selection
#define SENSOR_CUSTOM
#define MCP_23017_INOUT

// ENABLE WS2812 Led Support
#define WSLED
//used with ESP32 for non bit-bang led control
#define USE_WS2812_RMT 0

// https://tasmota.github.io/docs/Berry-Scripting/
#ifdef ESP32
  #ifdef USE_BERRY
    #undef USE_BERRY
  #endif
  #define USE_BERRY
#endif

#ifdef KEY_HOLD_TIME
  #undef KEY_HOLD_TIME
#endif
#define KEY_HOLD_TIME 12

#ifdef WIFI_IP_ADDRESS
  #undef WIFI_IP_ADDRESS
#endif
#define WIFI_IP_ADDRESS    ""

#ifdef WIFI_SUBNETMASK
  #undef WIFI_SUBNETMASK
#endif
#define WIFI_SUBNETMASK    ""

#ifdef WIFI_GATEWAY
  #undef WIFI_GATEWAY
#endif
#define WIFI_GATEWAY    ""

#ifdef WIFI_DNS
  #undef WIFI_DNS
#endif
#define WIFI_DNS    ""

#ifdef USE_EMULATION_WEMO
  #undef USE_EMULATION_WEMO
#endif

#ifdef USE_EMULATION_HUE
  #undef USE_EMULATION_HUE
#endif

#ifdef USE_MHZ19
  #undef USE_MHZ19
#endif

#ifdef USE_SENSEAIR
  #undef USE_SENSEAIR
#endif

#ifdef USE_PMS5003
  #undef USE_PMS5003
#endif

#ifdef USE_NOVA_SDS
  #undef USE_NOVA_SDS
#endif

#ifdef USE_HPMA
  #undef USE_HPMA
#endif

#ifdef USE_EMULATION
  #undef USE_EMULATION
#endif

#ifdef USE_EMULATION_HUE
  #undef USE_EMULATION_HUE
#endif

#ifdef USE_EMULATION_WEMO
  #undef USE_EMULATION_WEMO
#endif

#ifdef USE_TASMOTA_SLAVE
  #undef USE_TASMOTA_SLAVE
#endif

#ifdef USE_DISPLAY
  #undef USE_DISPLAY
#endif
//#define USE_DISPLAY

#ifdef USE_DISPLAY_MODES1TO5
  #undef USE_DISPLAY_MODES1TO5
#endif

#ifdef USE_DISPLAY_LCD
  #undef USE_DISPLAY_LCD
#endif

#ifdef USE_DISPLAY_SSD1306
  #undef USE_DISPLAY_SSD1306
#endif
//#define USE_DISPLAY_SSD1306

#ifdef USE_DISPLAY_MATRIX
  #undef USE_DISPLAY_MATRIX
#endif

#ifdef USE_DISPLAY_SH1106
  #undef USE_DISPLAY_SH1106
#endif

#ifdef USE_DISPLAY_ILI9341
  #undef USE_DISPLAY_ILI9341
#endif

#ifdef USE_DISPLAY_EPAPER_29
  #undef USE_DISPLAY_EPAPER_29
#endif

#ifdef USE_DISPLAY_EPAPER_42
  #undef USE_DISPLAY_EPAPER_42
#endif

#ifdef USE_DISPLAY_ILI9488
  #undef USE_DISPLAY_ILI9488
#endif

#ifdef USE_DISPLAY_SSD1351
  #undef USE_DISPLAY_SSD1351
#endif

#ifdef USE_DISPLAY_RA8876
  #undef USE_DISPLAY_RA8876
#endif

#ifdef USE_ADC_VCC
  #undef USE_ADC_VCC
#endif

#ifdef USE_DOMOTICZ
  #undef USE_DOMOTICZ
#endif

#ifdef USE_ENERGY_SENSOR
  #undef USE_ENERGY_SENSOR
#endif
#ifdef SENSOR_CUSTOM
  #define USE_ENERGY_SENSOR
#endif

#ifdef USE_PZEM004T
  #undef USE_PZEM004T
#endif
#ifdef SENSOR_CUSTOM
  #define USE_PZEM004T
#endif

#ifdef USE_PZEM_AC
  #undef USE_PZEM_AC
#endif
#ifdef SENSOR_CUSTOM
  #define USE_PZEM_AC  
#endif

#ifdef USE_PZEM_DC
  #undef USE_PZEM_DC
#endif
#ifdef SENSOR_CUSTOM
  #define USE_PZEM_DC
#endif

#ifdef USE_MCP39F501
  #undef USE_MCP39F501
#endif
#ifdef SENSOR_CUSTOM
  #define USE_MCP39F501
#endif

#ifdef USE_SDM120
  #undef USE_SDM120
#endif
#ifdef SENSOR_CUSTOM
  #define USE_SDM120
#endif

#ifdef USE_SDM630
  #undef USE_SDM630
#endif
#ifdef SENSOR_CUSTOM
  #define USE_SDM630
#endif

#ifdef USE_DDS2382
  #undef USE_DDS2382
#endif
#ifdef SENSOR_CUSTOM
  #define USE_DDS2382
#endif

#ifdef USE_DDSU666
  #undef USE_DDSU666
#endif
#ifdef SENSOR_CUSTOM
  #define USE_DDSU666
#endif

#ifdef USE_SOLAX_X1
  #undef USE_SOLAX_X1
#endif
#ifdef SENSOR_CUSTOM
  #define USE_SOLAX_X1
#endif

#ifdef USE_LE01MR
  #undef USE_LE01MR
#endif
#ifdef SENSOR_CUSTOM
  #define USE_LE01MR
#endif

#ifdef USE_HOME_ASSISTANT
  #undef USE_HOME_ASSISTANT
#endif
#define USE_HOME_ASSISTANT

#ifdef USE_MCP230xx
  #undef USE_MCP230xx
#endif

#ifdef USE_MCP230xx_OUTPUT
  #undef USE_MCP230xx_OUTPUT
#endif

#ifdef USE_MCP230xx_DISPLAYOUTPUT
  #undef USE_MCP230xx_DISPLAYOUTPUT
#endif

#ifdef USE_KNX
  #undef USE_KNX
#endif

#ifdef USE_IR_REMOTE
  #undef USE_IR_REMOTE
#endif
// removes USE_IR_RECEIVE as well

#ifdef USE_IR_REMOTE_FULL
  #undef USE_IR_REMOTE_FULL
#endif

#ifdef USE_DISCOVERY
  #undef USE_DISCOVERY
#endif

#ifdef USE_MQTT_TLS
  #undef USE_MQTT_TLS
#endif

#ifdef USE_RC_SWITCH
  #undef USE_RC_SWITCH
#endif

#ifdef USE_RULES
  #undef USE_RULES
#endif
#define USE_RULES

#ifdef USE_SCRIPT
  #undef USE_SCRIPT
#endif

#ifdef USE_TIMERS
  #undef USE_TIMERS
#endif
#define USE_TIMERS

#ifdef USE_TUYA_MCU
  #undef USE_TUYA_MCU
#endif
#define USE_TUYA_MCU

#ifdef USE_SR04
  #undef USE_SR04
#endif

#ifdef USE_WEBSERVER
  #undef USE_WEBSERVER
#endif
#define USE_WEBSERVER

#ifdef USE_WS2812
  #undef USE_WS2812
#endif
#ifdef WSLED
  #define USE_WS2812
#endif

#ifdef USE_ZIGBEE
  #undef USE_ZIGBEE
#endif

#ifdef USE_I2C
  #undef USE_I2C
#endif
#ifdef SENSOR_CUSTOM
  #define USE_I2C
  #define USE_BMP 
  #define USE_HTU

  #ifdef MCP_23017_INOUT
    #warning **** MCP230xx Setup: Using Settings from this File ****
    #define USE_MCP230xx                 // Enable INPUT mode (pinmode 1 through 4)
    #define USE_MCP230xx_ADDR 0x20
    #define USE_MCP230xx_OUTPUT          // Enable OUTPUT mode (pinmode 5)
    #define USE_MCP230xx_DISPLAYOUTPUT   // Display state of OUTPUT pins on main Tasmota web interface
  #endif
#endif

#ifdef USE_SPI
  #undef USE_SPI
#endif

#ifdef MY_LANGUAGE
  #undef MY_LANGUAGE
#endif
#define MY_LANGUAGE    en_GB

#ifdef MQTT_FULLTOPIC
  #undef MQTT_FULLTOPIC
#endif
#define MQTT_FULLTOPIC "iot/tasmota/%prefix%/%topic%/"

#ifdef TIME_DST_OFFSET
  #undef TIME_DST_OFFSET
#endif
#define TIME_DST_OFFSET -240

#ifdef TIME_STD_OFFSET
  #undef TIME_STD_OFFSET
#endif
#define TIME_STD_OFFSET -300

#ifdef APP_TIMEZONE
  #undef APP_TIMEZONE
#endif
#define APP_TIMEZONE 99

#ifdef SHRINK

  #ifdef USE_TIMERS_WEB
    #undef USE_TIMERS_WEB
  #endif
  #ifdef USE_SUNRISE
    #undef USE_SUNRISE
  #endif
  #ifdef USE_SONOFF_RF
    #undef USE_SONOFF_RF
  #endif
  #ifdef USE_SHELLY_DIMMER
    #undef USE_SHELLY_DIMMER
  #endif
  #ifdef WEBSERVER_ADVERTISE
    #undef WEBSERVER_ADVERTISE
  #endif
#endif

#endif
//end first ifndef
marc-gist commented 3 years ago

More information. I went back version to see if any were more stable. v9.1.0 is way more stable. v9.2.0 won't even compile as it gets a 404 error grabbing he esp32 framework i think (Error: Got the unrecognized status code '404' when downloaded https://github.com/tasmota/arduino-esp32/releases/download/1.0.4.2/esp32-1.0.4.2.zip)

v9.3.0 same stability issues. Particularly when changing the color/leds quickly it gets worse fast.

not sure what changed between v9.1 and 9.2/9.3 perhaps but it seems that's when stability issues started.

s-hadinger commented 3 years ago

I was using 9.3 and upgrade to 9.4, it's working flawlessly with Atom. No single glitch. I tried with your settings too, no issue. GPIO is 27.

You can find cheap Saleae clone of logic analyzers at 10€

marc-gist commented 3 years ago

I was using 9.3 and upgrade to 9.4, it's working flawlessly with Atom. No single glitch. I tried with your settings too, no issue. GPIO is 27.

You can find cheap Saleae clone of logic analyzers at 10€

i would suspect that is your WS2812C chips that handle it fine. do you have any ws2812b and esp32 dev boards? I I have tried many and the issue persists. FastLED works perfect on all devices and strips i have, WLED as well, which I think is based on fastled, or some other library.

s-hadinger commented 3 years ago

We are using this library: https://github.com/Makuna/NeoPixelBus

You can try to reach the author, there might be an issue in the timings.

ascillato2 commented 3 years ago

Hi, any news on this?

marc-gist commented 3 years ago

Unfortunately I have not had the time to test the library directly, outside of Tasmota.

github-actions[bot] commented 3 years ago

This issue was automatically closed because of being stale. Feel free to open a new one if you still experience this problem.