2
\$\begingroup\$

I am currently using a WaveShare cellular modem hat for my Raspberry Pi. The module has an onboard SIM7600A.

I've been reading the documentation and although all the commands work as they are supposed to, some commands fail when I try to execute them for the first time but succeed on a subsequent call.

An example of this would be:

AT+CGPS=1 #Enable GPS
ERROR 
AT+CGPS=1 
OK

Another example of this happening is when I try to get the GPS lock position (although it happens to most commands usually when attempting to execute them for the first time.)

AT+CGPSINFO #Return GPS fixed position 
ERROR
AT+CGPSINFO
+CGPSINFO: ,,,,,,,,
OK

This is my first time working with a cellular modem so I don't know if this behavior is expected, or if something is wrong with my board.

The following steps I tried to do to resolve this issue were increase my BAUD rate from 9600 to 115200. The reason for the change of BAUD was because I read somewhere that it times out when it doesn't receive the carriage return fast enough.

Another step I set AT+CMEE (Report mobile equipment error) to 2 in attempts to return verbose errors to track the issue. It does work when executing commands with purposely incorrect variables such as attempting to insert a wrong SIM pin. But with the errors mentioned above they are just reported as "ERROR".

I've looked all over google and can't find much on the subject so I was hoping someone with expertise can point me in the correct direction.

\$\endgroup\$
10
  • 1
    \$\begingroup\$ Welcome and nice to meet you. (1) Let me introduce myself. I have been playing with two SIM7600 Rpi HATs, and I spent a some time evaluating the SIM7600's built GPS stuff. Before that I spent some 200 hours playing with a couple of GPS modules. I also have 2000+ hours playing with serial UART stuff. (2) Now let me share my SIM/GPS/UART experience with you. / to continue, ... \$\endgroup\$
    – tlfong01
    Commented Jan 4, 2021 at 3:20
  • 1
    \$\begingroup\$ (4) About reliability of UART - (a) UART serial is by its nature not very reliable, (b) that is why it can use parity checking to detect any bad data transfer and repeat the transfer, (c) it is no clock to sync the bits, so if you use high speed, with long messages, you might lose sync and get wrong data received. (d) Almost always 9k6, or 4k8bd gives more reliable performance. (e) I would recommend to use default 9600bdN81. (e) do not worry that much getting errors, from time to time, or first time. Just resend. (f) Only worry if, say 8 out of 10 times, you get errors/ to continue, ... \$\endgroup\$
    – tlfong01
    Commented Jan 4, 2021 at 3:29
  • 1
    \$\begingroup\$ @tlfong01 Thank you so much for the information. I am not experienced with UART so I would of never guessed it. I suppose I’ll write a program that will just attempt to resend the command X amount of times on ERROR to determine if its an actual error or just a transmission error as you spoke of. \$\endgroup\$ Commented Jan 4, 2021 at 6:46
  • \$\begingroup\$ (5) Ah yes, if you already got this: "AT+CGPS=1 / OK", that is good news, because SIM7600 GPS module is responding. (6) Now the problem is this: "AT+CGPSINFO #Return GPS fixed position / ERROR, there are many reasons that you get this error message, eg, (a) You don't have a clear view of the sky, (b) Your antenna is not properly wired, and other reasons I forgot. (7) Perhaps I can later try to find my old test log and show you. I will be back. \$\endgroup\$
    – tlfong01
    Commented Jan 4, 2021 at 7:27
  • \$\begingroup\$ So I have found some of my old answers on GPS. You might like to just skim them to get a rough idea of how I learned the basic things. (7.1) GPS taking long time to fix out in the open Asked 4 months ago: electronics.stackexchange.com/questions/519711/…, (7.2) Rpi Neo-6M / Neo-8M GPS Module Setup / Fix / Update Problems Asked 6 months ago: raspberrypi.stackexchange.com/questions/113544/…, / to continue, ... \$\endgroup\$
    – tlfong01
    Commented Jan 4, 2021 at 7:42

1 Answer 1

1
\$\begingroup\$

RS232 might be a bit unreliable if used with long cables or crummy cables, but the fact is that across the "distance" of a couple of centimeter from the Pi to the "hat" there should be no problem.

I work with GSM modems in my day job, and never had a problem with RS232. It is more likely you are doing something wrong than that there are communication errors - especially given that they are so reproducible.

  • Check that you are sending correct line ends. Many programs will send a carriage return and a line feed at the end of a line of text. Some only send a carriage return or only a line feed. For most modems, you want to send only carriage returns. An unexpected line feed will cause some modems to return an "ERROR" with no further explanation.
  • Check that the power to the GSM modem is stable. If the power supply for your Pi is a little weak, the power to the modem may "wobble" when it tries to execute commands. That can cause errors.
  • Make sure that you are sending complete, correct commands. For example, your GPS command (AT+CGPS=1) takes some optional parameters on some modems (AT+CGPS=1,3 mean start the GPS session in UE-assisted mode for some modems.) If your modem tries to use a default mode that doesn't work, that may cause problems. In other words, use a more specific command (AT+CGPS=1,1 to start standard standalone GPS.)

Given your description, I tend towards the idea that you are sending mixed carriage returns and line feeds.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.