2

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.

JRE
  • 67,678
  • 8
  • 104
  • 179
  • 1
    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, ... – tlfong01 Jan 04 '21 at 03:20
  • 1
    (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, ... – tlfong01 Jan 04 '21 at 03:29
  • 1
    @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. – Trevin Corkery Jan 04 '21 at 06:46
  • (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. – tlfong01 Jan 04 '21 at 07:27
  • 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: https://electronics.stackexchange.com/questions/519711/gps-taking-long-time-to-fix-out-in-the-open/519716#519716, (7.2) Rpi Neo-6M / Neo-8M GPS Module Setup / Fix / Update Problems Asked 6 months ago: https://raspberrypi.stackexchange.com/questions/113544/rpi-neo-6m-neo-8m-gps-module-setup-fix-update-problems, / to continue, ... – tlfong01 Jan 04 '21 at 07:42
  • (7.3) How can Rpi listen to a GPS module? Asked 7 months ago Active 6 months ago Viewed 475 times https://raspberrypi.stackexchange.com/questions/113057/how-can-rpi-listen-to-a-gps-module/113066#113066 (7.4) How can Rpi connect a GPS module? Asked 1 year, 7 months ago Active 6 months ago Viewed 2k times https://raspberrypi.stackexchange.com/questions/98840/how-can-rpi-connect-a-gps-module, / to continue, ... – tlfong01 Jan 04 '21 at 07:43
  • (8) I think you are more or less OK talking to SIM7600 with AT commands. Just keep using the default 9k6baudN81, and don't try the fancy things such as autobaud detect, which I heard has a bug somewhere. (9) I guess you might has a problem getting a FIRST FIX, so you might skim my post to find a hint. – tlfong01 Jan 04 '21 at 07:51
  • In case you find it a hard time, without making any progress, I would suggest to get a cheap NEO-8M GPS module, and use the Windows based GUI NEO GPSD interface which I think is the most newbie friendly tool to learn GPSD. After you have learned the basics with the NEO-8M, then you can go back to SIM7600. Take you time and go slowly. Good luck and cheers. – tlfong01 Jan 04 '21 at 07:58
  • @TrevinCorkery Did you resolve this error.. I to have the same error – user284976 May 07 '21 at 08:15
  • @user284976 I stopped using it on my raspberry pi and started messing around with it on my STM32 micro controller. I haven't done much testing but when setting up the clock speed and the BSRR value to one that'd give no error percent in UART communcation it seems to work fine. – Trevin Corkery May 10 '21 at 05:59

1 Answers1

0

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.

JRE
  • 67,678
  • 8
  • 104
  • 179