Mega2560 serial2 HC-05

Something strange is happening on my Mega.

I connected HC-05 Bluetooth module with a Mega through Serial2 and it works. I can send things to a phone, etc. RX/TX lines are swapped, of course. When I connect it RX/RX to change a few things with AT commands, I get no response.

Weird thing is that the same connection goes fine with Serial3. The same way of connection. The same sketch.
On Serial3 works like a charm both mods, on Serial2 i can not send AT commands while RX/RX, TX/TX connection.

Here is the sketch. Of course i change Serial2 to Serial3 in the sketch.

void setup() { 
 Serial.begin(9600); 
 Serial2.begin(38400);
 digitalWrite( 17, INPUT_PULLUP );
 Serial.println("AT commands mode***"); 
} 
void loop() { 
 if (Serial2.available()) 
   Serial.write(Serial2.read()); 
 if (Serial.available()) 
   Serial2.write(Serial.read());
}

I tried some fix here:

But it didn't worked for me.

Just a little add...
Module is ZS-040

PS. Another weird thing
When connected with Serial3 with AT+UART? command I get +UART:9600,0,0
It should be 38400. ????

who_took_my_nick:
When I connect it RX/RX to change a few things with AT commands, I get no response.

No surprise there. Change it back to Rx>Tx. The 9600 you see is for communications mode. You are talking to it in AT mode 38400.