A7 gprs + gps problem

I have an arduino nano connected to an A7 gps + gprs module. The connections are as below;

U_RXD <=> D8 #TX
U_TXD <=> D7 #RX
PWR_KEY <=> D9

Here is a sample code for testing.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7,8); //Rx Tx
const int pwr_key = 9;
void setup() {
    Serial.begin(115200);
    mySerial.begin(9600);
    Serial.println("Initializing...");
    pinMode(pwr_key,OUTPUT);
    digitalWrite(pwr_key,HIGH);
    delay(2000);
    digitalWrite(pwr_key,LOW);
    delay(1000);
    while(!mySerial.available()) {
        Serial.println("Connecting...");
    }
    mySerial.println("AT");
    delay(100);
    Serial.write(mySerial.read());
}

void loop() {
    //do nothing
}

The SIM I use is registered and the frequency of operation of the A7 is well within the frequency of operation of mobile network operators.

After running this code it gets stuck in the while loop meaning is has not been able to register onto any network. Is there something I am doing wrong

That’s probably not the best way to determine if the modem is up & running.

What you could try... is call Serial.begin(...) then send CR every second until it replies with Serial.available() > 0

You can also print everything that is returned from the modem on the serial monitor...neo you can determine what it’s doing.

Is the ‘network/registered’ LED on the modem on / flashing as it should be?

Perhaps time to read some modem test examples to see what you’re doing.

Also, tying yo Serial for the modem is only sensible after you have it running- thus you can use the serial monitor or terminal for debugging until you’re sure the modem is working the way you want it.