1
\$\begingroup\$

enter image description hereI will try to explain my problem... I'm using a SIM808 GSM-GPS click module and a ARDUINO nano 33 IoT board, I'm sending the command "AT\r" thanks to the TX port from the ARDUINO board to the RX port from the SIM808. I have checked the signal thanks to an oscilloscope and he is corresponding to the the command. But now when I'm checking the answer on the TX port from the SIM808 there is absolutely nothing ... Normaly I have to received "OK" ...

Please HELP ME !!!

I'm using my ARDUINO in NL&CR and baud number is 115200. You can find bellow my Arduino code:

String incomingByte; // for incoming serial data;
String returnByte; // for outcoming serial data;

void setup() {
  // initialize both serial ports:
  Serial1.begin(115200,SERIAL_8N1); 
  Serial.begin(115200);
  delay(1000);
}
  
void loop() {
// send data only when you receive data:
  if (Serial.available() > 0) {
     while(Serial.available()!=0){

// read the incoming byte:
    //incomingByte = Serial.readString(); // In comments for only try with "AT\r"
    //Serial.print(incomingByte); // In comments for only try with "AT\r"
    //Serial1.println(incomingByte); // In comments for only try with "AT\r"
    Serial.println("AT\r");
    Serial1.print("AT\r");
    delay(10);
    }
    Serial.flush();
   }
    
//read the outcoming byte:

   if (Serial1.available() > 0) {
     while(Serial1.available()!=0){
     
    returnByte=Serial1.read();
    Serial.print(returnByte);
    }   
    Serial.flush();
    }
  } 
\$\endgroup\$
5
  • \$\begingroup\$ Your program logic doesn't make sense: essentially, on receipt of any character from the PC, you'll send the "AT\r" sequence to both the modem and the PC. That is definitely not what you want. Have a look at some example code written by someone with a clear goal, maybe the Adafruit FONA test/demo for example. \$\endgroup\$ Commented Oct 21, 2020 at 15:46
  • \$\begingroup\$ two comments ......... are you certain that you are using the correct baud rate for communication with the SIM808? ............ since you are using an oscilloscope to view the response, reduce the code in loop() to only this Serial1.print("AT\r"); delay(1000); .... nothing else is needed \$\endgroup\$ Commented Oct 21, 2020 at 18:18
  • \$\begingroup\$ Hello @ChrisStrattion, thank you for your return, In fact, I want to send the sequence to my modem and to my pc just to be sure that my program is running and to check what I'm sending. It's why I'm using "Serial.print()". My next goal is to send AT commands thanks to the Arduino terminal and I would like to see commands sent and answers of my modem directly in the Arduino terminal. \$\endgroup\$ Commented Oct 22, 2020 at 7:14
  • \$\begingroup\$ Hello @jsotola, thank you for your return, I'm certain to use the correct baud rate (115200), I checked this number in the datasheet and the software M-Center (with what I succeeded to send AT commands with USB port) was configured with the same baud rate. I tried to modify my program as you said but nothing append ... \$\endgroup\$ Commented Oct 22, 2020 at 7:28
  • \$\begingroup\$ After some hours of research I think that the problem can come from the Flow control, there is a pin CTS / RTS on the SIM808 modem, there is too a PowerKey pin. \$\endgroup\$ Commented Oct 23, 2020 at 6:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.