ledcWrite and Serial.println Conflict?

Brento
Posts: 21
Joined: Mon Apr 20, 2020 10:02 am

ledcWrite and Serial.println Conflict?

Postby Brento » Sat Jul 11, 2020 12:20 am

I originally posted this under the Hardware topic, but, I think this may not be a power issue at this point.

I am wondering if there is some sort of conflict possible with ledcWrite and the use of the serial ports?

In the code below, it seems that if I comment out ledcWrite from the setup, Serial.println("beep") works fine indefinitely.

Code: Select all

void setup()
{
	Serial.begin(9600);
	Serial.println("setup begin");

	ledcSetup(1, 25000, 8);
	ledcAttachPin(10, 1);
	ledcWrite(1, 20);
}

void loop()
{
	delay(5000);//limit click speed
	Serial.println("beep");
}
Also, if I comment out Serial.println("beep"), ledcWrite works properly, and the program works fine indefinitely.

But, with BOTH Serial.println("beep") and ledcWrite(1, 20) in effect, it will generate a Guru meditation error and reboot after about a minute. I am using the D2WD version of the processor. This behavior was not noticed on the D0WD version.

Code: Select all

Guru Meditation Error: Core  0 panic'ed (IllegalInstruction). Exception was unhandled.
Core 0 register dump:
PC      : 0x400d5f70  PS      : 0x00060730  A0      : 0x00000000  A1      : 0x3ffc4e50
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000000
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x800d6042  A9      : 0x3ffc4e10
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x3ffc3cc8  A13     : 0x00000000
A14     : 0x3ffc3c80  A15     : 0x00000000  SAR     : 0x00000000  EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000

Backtrace: 0x400d5f70:0x3ffc4e50 0x7ffffffd:0x3ffc4e70
Any suggestions?

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ledcWrite and Serial.println Conflict?

Postby lbernstone » Sat Jul 11, 2020 1:46 am

pin 10 is not available on either board. Please consult a pinmap https://github.com/espressif/arduino-es ... ard-pinmap

Brento
Posts: 21
Joined: Mon Apr 20, 2020 10:02 am

Re: ledcWrite and Serial.println Conflict?

Postby Brento » Sat Jul 11, 2020 2:46 am

pin 10 is not available on either board. Please consult a pinmap https://github.com/espressif/arduino-es ... ard-pinmap
Even for the D2WD chip? According to https://www.espressif.com/sites/default ... eet_en.pdf, page 10, the embedded flash uses different pins on the D2WD. Soo.. I assumed GPIO9 and 10 were available for use if I didn't attach external flash to them.

It's a little confusing that it doesn't mention they cannot be used (safely) in the D2WD.. ugh.

Who is online

Users browsing this forum: No registered users and 39 guests