SIM900 module connection problem (SOLVED)


I got this module recently for a project and it wouldn't neither connect to the NodeMCU ESP-12E not it could detect the network. I flashed the firmware successfully via PC's COM port (which I assume means Tx/Rx lines are OK). Now the module can detect the network (status LED flashes every 3 secs and when I call the card it gives me free signal) but NodeMCU can't connect to the module. I used every debug tool in Arduino IDE and the message they all gave me was "cannot initialize modem".
I did some PCB tracing and measurements to find out there are some mistakes in the schematics floating around so I compiled the version below based on my module. Actual measurements with the module disconnected from the NodeMCU are in yellow, when connected to NodeMCU are in green. The GSM module was powered with a 5V PSU (effectively 4V2 after the input diode).
The other thing I noticed on the scope is that signal amplitude at pin 9 is OK but after R8 it gets very weak at ~1V (maybe that's why it can't communicate with the MCU?). Also voltage drop across one of the MOSFETs is much bigger than the other. It looks like there's something going on with these MOSFETs so I would need your advice on this one. Can anyone tell what's the purpose of those MOSFETs? I ordered some replacement MOSFETs just in case but since NodeMCU Tx/Rx lines are 3.3V I was wondering if I can remove those and connect directly to R8/R9 (T3V/R3V)?

Replaced the MOSFETS without any effect. Flashed the module twice successfully. Still no connection. No signal at Tx from module.

After flashing the firmware several more times back and forth the module now responds to AT commands from PC's COM port but again no success connecting to NodeMCU.

I was able to establish communication with the module from the PC COM port with several terminal programs. It accepts and responds to AT commands. I was also able to make a phone call which means the module itself is working properly. The question is why it doesn't connect to the NodeMCU? Does it have anything to do with the fact NodeMCU uses the same Tx/Rx line for USB connection or it's a software problem?

I finally managed to get the module going by implementing Softwareserial. It looks like NodeMCU can’t handle another uart connection at TX0/RX0. Another thing to try would be Serial.Swap but being a novice I still can’t figure out how to do it for example here (hopefully without loosing the serial terminal):

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

// Select your modem:
//#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6

// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:

#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "token";

// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "My Telecom";
char user[] = "";
char pass[] = "";

// Hardware Serial on Mega, Leonardo, Micro
// #define SerialAT Serial1

// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(14, 12); // RX, TX

TinyGsm modem(SerialAT);

void setup()
  // Debug console


  // Set GSM module baud rate

  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");

  // Unlock your SIM card with a PIN

  Blynk.begin(auth, modem, apn, user, pass);

void loop()

After some experimenting I'm now running the module on Tx/Rx pins. My serial monitor for debugging purposes doesn't output much and maybe that allows for the module to run without interruptions.
What I did was to change

#define SerialAT Serial1


#define SerialAT Serial