M5Atom icon indicating copy to clipboard operation
M5Atom copied to clipboard

core panic when initialized lcd and adafruit neopixel

Open dawncold opened this issue 1 year ago • 0 comments

Describe the bug

I connected two RGB units with M5Atom, initiationly I'd like to use both internal LCD and RGB units together, but I found if I initialize the internal LCD(the last parameter of M5.begin(true, false, true);), it can not work with neopixel.

When I use parameterless begin, that means do not initialize LCD, it works fine.

To reproduce

M5Atom connects with a RGB unit, compile and upload it to M5Atom, click the button, leds should be lighten.

#include <M5Atom.h>
#include <Adafruit_NeoPixel.h>

int current_led_index = 0;
#define PIN       26  //定义NeoPixel的控制引脚
#define NUMPIXELS 6  //定义NeoPixel控制灯灯数量
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(
    NUMPIXELS, PIN,
    NEO_GRB + NEO_KHZ800);  // set number of LEDs, pin number, LED type.
                            // 设置灯的数量,控制引脚编号,灯灯类型

void setup() {
  M5.begin(true, false, true);
  // randomSeed(analogRead(0));
  pixels.begin();
  pixels.setBrightness(50);
}

void loop() {
  M5.update();
  if (M5.Btn.wasReleased()) {
    uint8_t random_r = random(256);
    uint8_t random_g = random(256);
    uint8_t random_b = random(256);
    Serial.print("set led ");
    Serial.print(current_led_index);
    Serial.print(" to color: 0x");
    Serial.print(random_r, HEX);
    Serial.print(random_g, HEX);
    Serial.println(random_b, HEX);
    
    pixels.clear();
    pixels.setPixelColor(current_led_index, random_r, random_g, random_b);
    pixels.show();
    delay(50);

    current_led_index = (current_led_index + 1) % NUMPIXELS;
  }
}

Expected behavior

do not panic

Screenshots

serial output

22:38:11.815 -> M5Atom initializing...OK
22:38:14.554 -> set led 0 to color: 0x332C98
22:38:14.844 -> Guru Meditation Error: Core  1 panic'ed (Interrupt wdt timeout on CPU1). 
22:38:14.844 -> 
22:38:14.844 -> Core  1 register dump:
22:38:14.844 -> PC      : 0x4008138c  PS      : 0x00050035  A0      : 0x400855ec  A1      : 0x3ffbf37c  
22:38:14.876 -> A2      : 0x00000000  A3      : 0x3ff56000  A4      : 0x01000000  A5      : 0x3ffc1f2c  
22:38:14.876 -> A6      : 0x00000000  A7      : 0x3ffbc9c0  A8      : 0x3ffc1f4c  A9      : 0x80000000  
22:38:14.876 -> A10     : 0x00000000  A11     : 0x00000000  A12     : 0x00000014  A13     : 0x00000004  
22:38:14.876 -> A14     : 0x3ffbcdc8  A15     : 0x80000001  SAR     : 0x00000000  EXCCAUSE: 0x00000006  
22:38:14.909 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
22:38:14.909 -> Core  1 was running in ISR context:
22:38:14.909 -> EPC1    : 0x400dd54b  EPC2    : 0x00000000  EPC3    : 0x400f4492  EPC4    : 0x00000000
22:38:14.909 -> 
22:38:14.909 -> 
22:38:14.909 -> Backtrace: 0x40081389:0x3ffbf37c |<-CORRUPTED
22:38:14.909 -> 
22:38:14.909 -> 
22:38:14.909 -> Core  0 register dump:
22:38:14.909 -> PC      : 0x400f4492  PS      : 0x00060535  A0      : 0x800dc19d  A1      : 0x3ffbc770  
22:38:14.941 -> A2      : 0x00000000  A3      : 0x40086514  A4      : 0x00060520  A5      : 0x3ffbbc50  
22:38:14.941 -> A6      : 0x007bf3b8  A7      : 0x003fffff  A8      : 0x800dbd9e  A9      : 0x3ffbc740  
22:38:14.941 -> A10     : 0x00000000  A11     : 0x3ffbf3b4  A12     : 0x3ffbf3b4  A13     : 0x00000000  
22:38:14.941 -> A14     : 0x00060520  A15     : 0x00000000  SAR     : 0x0000001d  EXCCAUSE: 0x00000006  
22:38:14.973 -> EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  
22:38:14.973 -> 
22:38:14.973 -> 
22:38:14.973 -> Backtrace: 0x400f448f:0x3ffbc770 0x400dc19a:0x3ffbc790 0x4008a1b5:0x3ffbc7b0
22:38:14.973 -> 
22:38:14.973 -> 
22:38:14.973 -> 
22:38:14.973 -> 
22:38:14.973 -> ELF file SHA256: 18db99f0b1322d84
22:38:14.973 -> 
22:38:15.133 -> Rebooting...
22:38:15.133 -> ets Jun  8 2016 00:22:57
22:38:15.133 -> 
22:38:15.133 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
22:38:15.133 -> configsip: 188777542, SPIWP:0xee
22:38:15.133 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
22:38:15.133 -> mode:DIO, clock div:1
22:38:15.133 -> load:0x3fff0030,len:1344
22:38:15.133 -> load:0x40078000,len:13964
22:38:15.133 -> load:0x40080400,len:3600
22:38:15.133 -> entry 0x400805f0
22:38:15.360 -> M5Atom initializing...OK

Environment

device: M5Atom platform: arduino IDE: Arduino 2.2.1 desktop version OS: Manjaro (almost latest packages)

Adafruit neopixel: 1.12.0 M5atom: 0.1.2

Additional context

No response

Issue checklist

  • [X] I searched for previous reports in the issue tracker
  • [X] My report contains all necessary details

dawncold avatar Jan 18 '24 14:01 dawncold