Assert failed on ledcWrite() ESP32

I’m stupid… I can’t get this to not CRASH!!!

Wtf is assert failed anyway?

Sample of stupid serial out

Pumpkin starting!/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40088869 on core 1

Backtrace: 0x4008c434:0x3ffb1e90 0x4008c665:0x3ffb1eb0 0x40088869:0x3ffb1ed0 0x400d4a6b:0x3ffb1f10 0x400d103f:0x3ffb1f30 0x400d544b:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0

STUPID CODE

#define NAME "CandleI 2a"



#include <WiFi.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

int rDelay, rBright, y1Bright, y2Bright, y3Bright;
int y4Bright, o1Bright, o2Bright;

//Brightness Q
int colorCorrection[3] { 255, 64, 32 };

//Global Delay
#define TMIN 10
#define TMAX 125

//Tendency to Change (percent)
#define DELTAPCT 30

// PIN-MAP
//*****************************************************************************************************************************************************************
// -1: InputPullup, 0: Not installed, 1: Input Positive, 2: OUTPUT
int installed[20] = {  2,   2,    2,    2,    2,    2,    2,    1 };
int pinNumbers[20] = { 5,   13,   17,   18,   19,   32,   33,   34 };
int colorID[20] = {    0,   2,    0,    0,    0,    1,    1,    -1 };
// *****************************************************************************************************************************************************************

void setup() {

  Serial.begin(115200);
  Serial.print("Pumpkin starting!");
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    // Serial.println("Connection Failed! Rebooting...");
    delay(5000);
    ESP.restart();
  }

  // Port defaults to 3232
  // ArduinoOTA.setPort(3232);

  // Hostname defaults to esp3232-[MAC]
  ArduinoOTA.setHostname(NAME);

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f277a57a5a743874a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f277a57a5a743874a0e4a801fc3");

  ArduinoOTA
  .onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    // Serial.println("Start updating " + type);
  })
  .onEnd([]() {
  })
  .onProgress([](unsigned int progress, unsigned int total) {
  })
  .onError([](ota_error_t error) {
  });

  ArduinoOTA.begin();

  for (int i = 0; i < 9; i++) {
    // Array init loop

    // Set pin-modes based on installed flags
    if (installed[i] == -1) {
      pinMode(pinNumbers[i], INPUT_PULLUP);
    }
    if (installed[i] == 1) {
      pinMode(pinNumbers[i], INPUT);
    }
    if (installed[i] == 2) {
      pinMode(pinNumbers[i], OUTPUT);
      Serial.println("Attaching channel");
      Serial.print(i);
      Serial.print(" to pin #");
      Serial.print(pinNumbers[i]);
      ledcAttachPin(pinNumbers[i], i);
    }
  }
}

int levels[8] = { 0 };

void loop() {
  delay(1);
  Serial.print("Loop at millis");
  Serial.println(millis());
  ArduinoOTA.handle();
  // put your main code here, to run repeatedly:
  float Bright;
  for (int i = 0; i <= 7; i++) {
    Bright = random(0, 100);
    levels[i] = (Bright / 100) * colorCorrection[colorID[i]];
  }

  for (int i = 0; i <= 7; i++) {
    Serial.print("Lighting up led:");
    Serial.print(colorID[i]);
    Serial.print(i);
    Serial.print("  to brightness level:");
    Serial.print(levels[i]);
    ledcWrite(i, levels[i]);
  }
  rDelay = random(TMIN, TMAX);
  delay(rDelay);
}

Also tried another ESP32… same darn issue…
Gonna try looking for that file. Win8 takes FOREVER to file search!

Still waiting on fileseach from C: for freertos…


Queue.c:1442 is right smack in between comments… a lot of a help that is!

mattlogue:
Gonna try looking for that file. Win8 takes FOREVER to file search!

That's a PoS OS. Get off of it.
For searches, try Agent Ransack.

Some places 9, some places 7.

Why the magic numbers?

Why are you searching for the file? The message contains a path:

/
home/
runner/
work/
esp32-arduino-lib-builder/
esp32-arduino-lib-builder/
esp-idf/
components/
freertos/
queue.c

TheMemberFormerlyKnownAsAWOL:
Some places 9, some places 7.

Why the magic numbers?

Well nine pins were supposed to be reserved for function. Seven, however, are input.

johnwasser:
Why are you searching for the file? The message contains a path:

/
home/
runner/
work/
esp32-arduino-lib-builder/
esp32-arduino-lib-builder/
esp-idf/
components/
freertos/
queue.c

Becuase I don't have the foggiest idea where home/runner/ are... never seen them and I looked around a lot doing this ESP stuff. BTW: that line on queue.c where i DID find it went to a line in comments!

mattlogue:
Well nine pins were supposed to be reserved for function. Seven, however, are input.

But you appear to be using eight.

OK so i’m not perfect…I got fired and i’m really down… must of miscounted.

Get back to the issue. I tried googling it and apparently ledcWrite() works fine for most folks…

It crashes in any sketch…

Do I need to reinstall the ESP IDF or what?

Snippet

void setup() {
  Serial.begin(115200);
  ledcAttachPin(13, 0);
  ledcWrite(0, 1); <<< BLAM! 
  Serial.println("Booting");
  WiFi.mode(WIFI_STA);

Error:
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:1442 (xQueueGenericReceive)- assert failed!
abort() was called at PC 0x40088869 on core 1

Backtrace: 0x4008c434:0x3ffb1ec0 0x4008c665:0x3ffb1ee0 0x40088869:0x3ffb1f00 0x400d499b:0x3ffb1f40 0x400d10e6:0x3ffb1f60 0x400d537b:0x3ffb1fb0 0x40088b7d:0x3ffb1fd0

Well i'm going to try removign the board from IDE and reinstalling...

Fail!

Crap!! Tried ransack search and it can't find that damned queue.c... actually queue.c exists in a few places, but I tried finding folder freertos and runner. Nothing viable.

Searched ALL of C:\ for "\runner" - two matches and nothing near what I want.

My guess is that I fubared the config or something with this IDF not knowing what I was doing and forgot about it. I found the thing on github but not sure where to put it since I can't find original. I'm stuck.

Removing python... hopefully it clears appdata

Shit.

Where the HELL is this freertos folder?

Ah screw it... I'll find my esp8266 and use analogWrite

Done. Jack o lantern