espressif / arduino-esp32

Arduino core for the ESP32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arduino 3.0.x doesn't work with RMT Legacy Driver

Xylopyrographer opened this issue · comments

Board

ESP32S3 Dev Module

Device Description

ESP32S3 Dev Module with an on-board WS2812 RGB LED on GPIO48.

Hardware Configuration

No

Version

v3.0.1

IDE Name

Arduino IDE 2.3.2

Operating System

Debian 12

Flash frequency

Flash Mode: "QIO 80MHZ"

PSRAM enabled

yes

Upload speed

921600

Description

When using the legacy RMT driver as per:
https://docs.espressif.com/projects/esp-idf/en/v5.1.4/esp32/migration-guides/release-5.x/5.0/peripherals.html#rmt-driver
and when USB CDC On Boot is set to "Disabled" the sketch below runs.

If however USB CDC On Boot is set to "Enabled" the sketch crashes into a boot loop. Crash log is below.

The LiteLED library uses only ESP-IDF calls.

To test, must use the LiteLED v3 development branch at: https://github.com/Xylopyrographer/LiteLED/tree/v1.3

Sketch

// arduino-esp32 core v3.0.1 RMT legacy driver bug
// must use LiteLED v1.3.0-dev at https://github.com/Xylopyrographer/LiteLED/tree/v1.3

#include <LiteLED.h>

#define LED_GPIO        48  // change this number to be the GPIO pin connected to DIN of the matrix panel
#define LED_TYPE        LED_STRIP_WS2812
#define LED_TYPE_IS_RGBW    0   // if the LED matrix uses RGBW type LED's, change the 0 to 1

static const uint8_t currBright = 20;    // change this to set the brightness level of the matrix
static const crgb_t BLINK_COL = 0x00002f;

LiteLED myDisplay( LED_TYPE, LED_TYPE_IS_RGBW );    // create the LiteLED object

void setup() {
    delay( 2000 );
    printf( "printf: Sketch in setup()" );
    Serial.begin( 115200 );
    delay( 2000 );
    Serial.println( "Sketch in setup()" );

    myDisplay.begin( LED_GPIO, 1, 0 );        // initialze the myDisplay object.
    myDisplay.brightness( currBright );
    myDisplay.setPixel( 0, BLINK_COL, 1 );
}

void loop() {
  // blink a pixel   
  myDisplay.brightness( 0, 1 );
  delay( 1000 );

  myDisplay.brightness( currBright, 1 );
  delay( 1000 );
}

Debug Message

With USB CDC On Boot: "Enabled":

Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40377d1d
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29e4
entry 0x403c9880
E (91) rmt(legacy): CONFLICT! driver_ng is not allowed to be used with the legacy driver

abort() was called at PC 0x4200951f on core 0

Backtrace: 0x4037770a:0x3fceb200 0x4037c4bd:0x3fceb220 0x40381f11:0x3fceb240 0x4200951f:0x3fceb2c0 0x4200d166:0x3fceb2e0 0x40377a0f:0x3fceb310 0x403cd852:0x3fceb340 0x403cdafe:0x3fceb380 0x403c98d5:0x3fceb4b0 0x40045c01:0x3fceb570 0x40043ab6:0x3fceb6f0 0x40034c45:0x3fceb710

ESP Exception Decoder
Sketch: S3_RMT_Bug FQBN: esp32:esp32:esp32s3

Backtrace: 0x4037770a:0x3fceb200 0x4037c4bd:0x3fceb220 0x40381f11:0x3fceb240 0x4200951f:0x3fceb2c0 0x4200d166:0x3fceb2e0 0x40377a0f:0x3fceb310 0x403cd852:0x3fceb340 0x403cdafe:0x3fceb380 0x403c98d5:0x3fceb4b0 0x40045c01:0x3fceb570 0x40043ab6:0x3fceb6f0 0x40034c45:0x3fceb710

Decoding stack results
0x4037770a: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:466
0x4037c4bd: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/port/esp_system_chip.c:84
0x40381f11: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/abort.c:38
0x4200951f: check_rmt_legacy_driver_conflict at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/driver/deprecated/rmt_legacy.c:1380
0x4200d166: start_cpu0_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/startup.c:205
0x40377a0f: call_start_cpu0 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/xtensa/include/xt_utils.h:40

Other Steps to Reproduce

Crash occurs whenever USB CDC On Boot is enabled, regardless of other USB settings and whether PSRAM is enabled or not.

Serial monitor output with Core Debug Level: "Debug" and USB DFU On Boot: "Disabled":

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x508
load:0x403c9700,len:0x4
load:0x403c9704,len:0xad0
load:0x403cc700,len:0x29e4
entry 0x403c9880
[   310][I][esp32-hal-psram.c:90] psramInit(): PSRAM enabled
=========== Before Setup Start ===========
Chip Info:
------------------------------------------
  Model             : ESP32-S3
  Package           : 0
  Revision          : 1
  Cores             : 2
  Frequency         : 240 MHz
  Embedded Flash    : No
  Embedded PSRAM    : No
  2.4GHz WiFi       : Yes
  Classic BT        : No
  BT Low Energy     : Yes
  IEEE 802.15.4     : No
------------------------------------------
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   405836 B ( 396.3 KB)
  Free Bytes        :   378016 B ( 369.2 KB)
  Allocated Bytes   :    23044 B (  22.5 KB)
  Minimum Free Bytes:   372968 B ( 364.2 KB)
  Largest Free Block:   335860 B ( 328.0 KB)
------------------------------------------
SPIRAM Memory Info:
------------------------------------------
  Total Size        :  2097152 B (2048.0 KB)
  Free Bytes        :  2095104 B (2046.0 KB)
  Allocated Bytes   :        0 B (   0.0 KB)
  Minimum Free Bytes:  2095104 B (2046.0 KB)
  Largest Free Block:  2064372 B (2016.0 KB)
  Bus Mode          : QSPI
------------------------------------------
Flash Info:
------------------------------------------
  Chip Size         :  8388608 B (8 MB)
  Block Size        :    65536 B (  64.0 KB)
  Sector Size       :     4096 B (   4.0 KB)
  Page Size         :      256 B (   0.2 KB)
  Bus Speed         : 80 MHz
  Bus Mode          : QIO
------------------------------------------
Partitions Info:
------------------------------------------
                nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
            otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
               app0 : addr: 0x00010000, size:  1920.0 KB, type:  APP, subtype: OTA_0
               app1 : addr: 0x001F0000, size:  1920.0 KB, type:  APP, subtype: OTA_1
             spiffs : addr: 0x003D0000, size:   128.0 KB, type: DATA, subtype: SPIFFS
           coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
------------------------------------------
Software Info:
------------------------------------------
  Compile Date/Time : Jun 14 2024 17:26:18
  Compile Host OS   : linux
  ESP-IDF Version   : v5.1.4-51-g442a798083-dirty
  Arduino Version   : 3.0.1
------------------------------------------
Board Info:
------------------------------------------
  Arduino Board     : ESP32S3_DEV
  Arduino Variant   : esp32s3
  Arduino FQBN      : esp32:esp32:esp32s3:UploadSpeed=921600,USBMode=hwcdc,CDCOnBoot=default,MSCOnBoot=default,DFUOnBoot=default,UploadMode=default,CPUFreq=240,FlashMode=qio,FlashSize=8M,PartitionScheme=min_spiffs,DebugLevel=debug,PSRAM=enabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default
============ Before Setup End ============
Sketch in setup()
=========== After Setup Start ============
INTERNAL Memory Info:
------------------------------------------
  Total Size        :   405836 B ( 396.3 KB)
  Free Bytes        :   375564 B ( 366.8 KB)
  Allocated Bytes   :    25096 B (  24.5 KB)
  Minimum Free Bytes:   370516 B ( 361.8 KB)
  Largest Free Block:   335860 B ( 328.0 KB)
------------------------------------------
SPIRAM Memory Info:
------------------------------------------
  Total Size        :  2097152 B (2048.0 KB)
  Free Bytes        :  2094844 B (2045.7 KB)
  Allocated Bytes   :      244 B (   0.2 KB)
  Minimum Free Bytes:  2094844 B (2045.7 KB)
  Largest Free Block:  2064372 B (2016.0 KB)
------------------------------------------
GPIO Info:
------------------------------------------
  GPIO : BUS_TYPE[bus/unit][chan]
  --------------------------------------  
    43 : UART_TX[0]
    44 : UART_RX[0]
============ After Setup End =============

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Short answer is yes, using neopixelWrite() works with USB CDC On Boot either Enabled or Disabled.

Real question is why does Enabling USB CDC On Boot crash the legacy RMT driver at runtime while Disabling USB CDC On Boot does not?

Agree on the real question. @SuGlider will have a look