ESP32 D2WD won't start on some compiles (byte alignment?)

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

ESP32 D2WD won't start on some compiles (byte alignment?)

Postby Brento » Mon Jan 25, 2021 9:27 am

I've been having an intermittent problem lately, where 1 in 4 downloads to my custom-built ESP32 boards won't launch, despite perfectly valid compiling code.

I get the following message on the serial monitor "VMDPV_1|1_".. and nothing else executes. The strange thing is, that this happens immediately at the start of the program, even if I change code that is executing at a much later time, so it's not related to the details of the code itself.

For example, in the loop(), which begins ~30 seconds after setup, the program won't execute with this code:

Code: Select all

void loop()
{
	Result result;
	int eventId = _TFT.ProcessEvents();
	if (eventId == INTERRUPT_TIMER)
	{
		_TFT.crashtest(testTFT); //<----  notice this is a boolean variable argument
		testTFT = !testTFT;
	}
	else if (eventId == UNKNOWN_EVENT)
	{
		Serial.println(F("Main Menu - Unexpected Event."));
	}
	delay(150);
}
But this nearly identical code will run the entire program as normal:

Code: Select all

void loop()
{
	Result result;
	int eventId = _TFT.ProcessEvents();
	if (eventId == INTERRUPT_TIMER)
	{
		_TFT.crashtest(true);//<----  fixed variable as true
		testTFT = !testTFT;
	}
	else if (eventId == UNKNOWN_EVENT)
	{
		Serial.println(F("Main Menu - Unexpected Event."));
	}
	delay(150);
}
This is only one example of many dozens of situations where normal looking code causes this problem. The program is fairly big, with TFT, Bluetooth and Servo libraries, to name a few. All the libraries work fine on most compiles. This is neither compiling issue, nor a problem with the library itself. The library works fine if I hard-code 'false' the 2nd example, too.

It's as if there is some sort of memory alignment issue.. but I have no idea how to change or diagnose that using the Visual Micro and Arduino tools. I am using the ESP32 Dev Module project settings, tweaked for D2WD in Visual Micro. Perhaps there is a setting there that can fix this?

Any suggestions?
Thanks

Who is online

Users browsing this forum: No registered users and 33 guests