XIAO ESP32-C3 on bootloop when using Adafruit Neopixel library

Hello, everybody!

I’m starting to use Seed Studio XIAO ESP-C3. I uploaded it a couple of very simple Arduino test programs successfully.

But when I tried to upload the Neopixel-control program I bought it for and… I only got an infinite loop of restarts and errors via serial terminal. Just in case my code could be the cause, I tried the to upload the “simple” Adafruit Neopixel test program and got the same results.

This is the message appearing on a loop:

ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382028
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000

I have changed and tested different data pin value, and tried uploading other Adafruit test programs with the same dissapointing results.

Has anyone else tested this library on ESP32-C3? Is XIAO ESP32-C3 Adafruit NeoPixel-incompatible? Any advice to get ir working?

Hello, I recently tested the Adafruit Neopixel library and found no problems, combined with the information you provided, I think there is a problem with your program upload。

Hi, nengyu!

That option seems unlikely for my case, as long as I have uploaded other three different example programs on my XIAO ESP-C3, and the other ones upload and execute correctly. That’s why I tend to think my Arduino Studio board configuration for upload is right. By the way, this is my configuration:

Board:XIAO_ESP32C3
Upload Speed: 921600 (I have also tried with slower speeds)
USB CDC On Boot: Enabled
CPU Frequency: 160 MHz (Wifi) (I have also tried with slower frequencies)
Flash Frequenxy: 80 MHz (I have also tried with slower frequencies)
Flash Mode QIO (I have also tried with the rest of options)
Flash Size: 4 MB (32 Mb)
Partition Scheme: Default 4 MB with spiffs (1,2MB APP/1.5MB SPIFFS)
Core Debug Level: None
Erase All Flash Before Sketch Upload: Disabled
Port: /dev/ttyACM0 (ESP32S3 Dev Module)

Do you think it is possible that some programs upload correctly and others not?

And this is one of the simple NeoPixel programs I tried to upload but failed… As you see, it is quite simple:

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 10 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter – see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(AVR_ATtiny85) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.

pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
pixels.clear(); // Set all pixel colors to ‘off’

// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel…

// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 150, 0));

pixels.show();   // Send the updated pixel colors to the hardware.

delay(DELAYVAL); // Pause before next pass through loop

}
}

Thanks!

I bet your using too much “JUICE” does it upload successfully?
GL
:slight_smile:

Yes, according to the messages on the upload windows, it does upload successfully, of course! That’s the first fact to check :smiley:

At least it seems so for me… These are the messages:

Sketch uses 217840 bytes (16%) os storage space. Maximum is 1310720 bytes.
Global variables use 9700 bytes (2%) of dynamic memory, leaving 317980 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.2.1
Serial port /dev/ttyACM0
Connecting…
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: a0:76:4e:3f:d8:3c
Uploading stub…
Running stub…
Stub running…
Changing baud rate to 921600
Changed.
Configuring flash size…
Flash will be erased from 0x00000000 to 0x00003fff…
Flash will be erased from 0x00008000 to 0x00008fff…
Flash will be erased from 0x0000e000 to 0x0000ffff…
Flash will be erased from 0x00010000 to 0x00047fff…
Compressed 12944 bytes to 9297…
Writing at 0x00000000… (100 %)
Wrote 12944 bytes (9297 compressed) at 0x00000000 in 0.3 seconds (effective 340.6 kbit/s)…
Hash of data verified.
Compressed 3072 bytes to 128…
Writing at 0x00008000… (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 443.6 kbit/s)…
Hash of data verified.
Compressed 8192 bytes to 47…
Writing at 0x0000e000… (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 524.5 kbit/s)…
Hash of data verified.
Compressed 228176 bytes to 128488…
Writing at 0x00010000… (12 %)
Writing at 0x0001ac43… (25 %)
Writing at 0x00021850… (37 %)
Writing at 0x00027831… (50 %)
Writing at 0x0002da64… (62 %)
Writing at 0x00033ace… (75 %)
Writing at 0x0003b7ba… (87 %)
Writing at 0x00042757… (100 %)
Wrote 228176 bytes (128488 compressed) at 0x00010000 in 3.2 seconds (effective 576.0 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…

BTW… I don’t know what do you exactly mean by using too much “juice”.

Thanks!

Ah’ that looks correct , Yes Upload looks good, I was referring to the connections? and perhaps your pulling too much current from the connections. i.e sourcing too much as an output ?
I don’t see any connection info , so it’s meant only as a guess.
The Loop is for sure though, I can get that from my XiaoESP32c3 with bad code easy.
HTH
GL :slight_smile:

Hi, PJ!

Thanks for your answer. I think the connections are correct, because:

  • It doesn’t matter if I power the neopixel strip from an outside power strip, the error persists
  • The connections should be allright, because I use the same wires as I use with an standard ESP32, and they work correctly on the ESP32.
  • Even if I completely disconnect the XIAO ESP32-C3 from the Neopixel Strip, the error persists. In an standard ESP32, it runs conrrectly both connected and disconnected from the strip. The program just sends data and doesn’t read from the neopixel strip.

I would like to know if the simple test program I transcribed on my second post just runs on an XIAO ESP32-C3 from somebody, not showing the error messages I see in serial console. If it happens that way, it may happen that my XIAO ESP32-C3 is defective and I have request a new one.

Regards!

your code,

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library

#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif

// Which pin on the Arduino is connected to the NeoPixels?
#define PIN 10 // On Trinket or Gemma, suggest changing this to 1

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16 // Popular NeoPixel ring size

// When setting up the NeoPixel library, we tell it how many pixels,
// and which pin to use to send signals. Note that for older NeoPixel
// strips you might need to change the third parameter – see the
// strandtest example for more information on possible values.
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
// These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
// Any other board, you can remove this part (but no harm leaving it):
#if defined(AVR_ATtiny85) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
// END of Trinket-specific code.

pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
pixels.clear(); // Set all pixel colors to ‘off’

// The first NeoPixel in a strand is #0, second is 1, all the way up
// to the count of pixels minus one.
for(int i=0; i<NUMPIXELS; i++) { // For each pixel…

// pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
// Here we're using a moderately bright green color:
pixels.setPixelColor(i, pixels.Color(0, 150, 0));

pixels.show();   // Send the updated pixel colors to the hardware.

delay(DELAYVAL); // Pause before next pass through loop
}
}

after I loaded the Adafruit NeoPixel 1.10.7. lib Compiled AOK, and Uploaded AOK.

This is what I got after uploading as-is and pressing reset upon successful reset.

rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4200ee6e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000

HTH
to recover I loaded this and it’s back to working correctly.

/* The true ESP32 chip ID is essentially its MAC address.
This sketch provides an alternate chip ID that matches 
the output of the ESP.getChipId() function on ESP8266 
(i.e. a 32-bit integer matching the last 3 bytes of 
the MAC address. This is less unique than the 
MAC address chip ID, but is helpful when you need 
an identifier that can be no more than a 32-bit integer 
(like for switch...case).

created 2020-06-07 by cweinhofer
with help from Cicicok */
	
uint32_t chipId = 0;

void setup() {
	Serial.begin(9600);
  delay (2000);

  for(int i=0; i<17; i=i+8) {
	  chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
	}

	Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
	Serial.printf("This chip has %d cores\n", ESP.getChipCores());
  Serial.print("Chip ID: "); Serial.println(chipId);
  
	delay(3000);
}

void loop() {
	

}

Serial output after…

ESP32 Chip model = ESP32-C3 Rev 3
This chip has 1 cores
Chip ID: 4196588

GL :slight_smile:

Hi, PJ!

After yout notification of success, I continued trying and had success after… updating Neopixel library! Sorry I hadn’t noticed. So I can confirm problem is…

[SOLVED]: I hadn’t noticed my neopixel library wasn’t updated, and after updating, I have success managing Neopixel lights.

Thanks for the help, PJ!

Regards!
Ed

2 Likes