problems with DF2301Q and ESP32

I have a few DF2301Q-EN modules. I know that they work, because I've tested them with Uno3 on I2C with I/O expansion shield. Connecting it with ESP32 is a different matter. I've used ESP32 for many years, it's a dev board that's very familiar to me.
The sample code on https://wiki.dfrobot.com/SKU_SEN0539-EN_Gravity_Voice_Recognition_Module_I2C_UART just doesn't work on ESP32.
The I2C code from wiki compiles and uploaded but causes panic:
"18:26:56.306 -> rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
18:26:56.306 -> configsip: 0, SPIWP:0xee
18:26:56.306 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
18:26:56.350 -> mode:DIO, clock div:1
18:26:56.350 -> load:0x3fff0030,len:1448
18:26:56.350 -> load:0x40078000,len:14844
18:26:56.350 -> ho 0 tail 12 room 4
18:26:56.350 -> load:0x40080400,len:4
18:26:56.350 -> load:0x40080404,len:3356
18:26:56.350 -> entry 0x4008059c
18:26:57.429 -> ets Jul 29 2019 12:21:46"
UART sample code come up with a compilation error: "Compilation error: 'D3' was not declared in this scope; did you mean 'T3'?"
My ESP32 board is a generic “ESP32 Dev Module - Wroom 32d”, I've tried different chips that I know work. This board would run pretty much anything ESP32 do, never had compatibility issues.
Can anyone help getting sample code to work on ESP32?
The UART Example Compilation Error ('D3' was not declared)
That’s because D3 and D4 are Arduino Uno pin aliases — ESP32 core does not define them. On ESP32 you just use GPIO numbers.
For example, if you wired:
TX (module) → GPIO16 (RX2 on ESP32)
RX (module) → GPIO17 (TX2 on ESP32)
You would replace the sample code’s D3, D4 with actual GPIO numbers:
#include <HardwareSerial.h>
#include "DFRobot_DF2301Q.h"
HardwareSerial mySerial(2); // Use UART2
DFRobot_DF2301Q_UART DF2301Q;
void setup() {
Serial.begin(115200);
// Initialize UART2 on GPIO16=RX, GPIO17=TX
mySerial.begin(115200, SERIAL_8N1, 16, 17);
while (!DF2301Q.begin(mySerial)) {
Serial.println("Communication with DF2301Q failed, check wiring!");
delay(1000);
}
Serial.println("DF2301Q connected (UART)!");
}
void loop() {
uint8_t CMDID = DF2301Q.getCMDID();
if (CMDID != 0) {
Serial.print("CMD ID: ");
Serial.println(CMDID);
}
delay(100);
}

I assume you are using the Arduino framework on the ESP32. ESP32 is generic, which chip does your board have (i.e. ESP32-S3, etc.), and did you verify compatibility?
