Guide by Tim; 4G and GPS HAT For Raspberry Pi - Waveshare SIM7600X

Hi @Gordon291277

Welcome to the forum!

It would be possible to do so, you would need to enable Caller ID Display (CLIP) with the AT command:

AT+CLIP=1

Once that is activated, when you receive a call you should get a response with the following format

RING
+CLIP: "<phonenumber>",<type>,<subaddr>,<satype>

From there you will be able to hang up the call with the AT command

ATH

To separate the number out you would need to put together some code to remove the other stuff from the response that was given by the first AT command.

Thanks Dan. I’m very new to this - I’m not sure how I would write code to wait for and receive a call.
I assume where you have written “RING”, that is when an incoming call is being made?
What is the “+CLIP:” bit, is that an AT command?

Hi @Gordon291277

The second code block from my last post will be what is written to serial by the module to the Pi

Hi all,
Want to prefece this with the fact that I am a total NOOB with all kinds of coding and electronics.
I was able to follow the tutorial as best I could, besides some hiccups to do with permission. However, when trialing the hat using the Python codes I ran to greater issues. PhoneCall.py worked, however, GPS.py resulted:
AT+CGPSINFO
+CGPSINFO: , , , , , , , ,

Not sure if this is a problem to do with the Pi, GPS or location I am testing it in. Further, I was unable to send a text using SMS.py and waspromptedd with the following:

ERROR
Back:

+CMS ERROR: Unknown error

error
Received Short Message Test:

Please send message to phone *04XXXXXX
Setting SMS mode…
AT+CMGF=1
OK

AT+CMGF=1
+CMGR: “REC READ”,“791121161171151777115103”,“”,

and this is then followed by the activation date of my sim card. (Optus pre-paid)
I am just wondering if this a purely sim related issue as I was able to make that phone call using it. Any suggestions and comments would be greatly appreciated.

Warm regards,
Fin

2 Likes

Hi @finlay297680

Welcome to the forum!

You’re definitely not alone with these early roadblocks. The fact that PhoneCall.py worked means your HAT, SIM, and AT-command interface are basically healthy, great start.

GPS Issue (+CGPSINFO: , , , , , , , ,)

This response just means the GPS hasn’t acquired a satellite fix yet. Common causes:

  • You’re indoors or under cover — GPS needs a clear view of the sky. Try placing the GPS receiver’s sticker side face down and outside
  • It’s a cold start — first-time or long-unpowered modules can take 5–15 minutes to download satellite data.

Suggestions:

  1. Move the Pi + HAT outdoors with a clear view of the sky.
  2. Before running GPS.py, try sending these manually:
AT+CGPS=1,1      // Enables GPS engine with NMEA output to UART
AT+CGPSINFO      // Poll for current GPS fix
  1. Wait 5–10 minutes, then run AT+CGPSINFO again. Once it gets a fix, it’ll return something like:
+CGPSINFO: 42.4336,N,84.0880,W,210101,123456.000,1.2,0.9,1

SMS Issue (+CMS ERROR: Unknown error)

Even if calling works, SMS can be tripped up by SIM or network quirks:

  • SIM activation – Some Optus prepaid SIMs allow calls but block SMS until activated via the Optus app or website.
  • Balance/profile – Ensure the SIM has credit and isn’t data-only.
  • Text mode – Confirm the modem is in text mode:
AT+CMGF=1
  • PIN status – Check that the SIM isn’t PIN-locked:
AT+CPIN?

Debug steps:

  1. Insert the SIM into a phone and confirm you can send/receive SMS.
  2. On the Pi, check:
AT+CSQ       // Signal strength
AT+CREG?     // Network registration status
AT+COPS?     // Current operator
  1. If Optus still doesn’t behave, try a Telstra or Vodafone SIM to compare.

Post back the results of those commands or any new errors, and we’ll help you dig in further. Once GPS has a lock and SMS is sorted, you’ll be all set!

2 Likes

Sorry this may be dumb, but where am i imputting these commands? Also thank you so much for the response Ryan, sorry for my delay lifes caught up to me recently.

1 Like

Additionally, I have been able to replace the SIM card with my personal one. In doing so, I have changed the error code from the previous to
"`AT+CMGR=1 ERROR
AT+CMGR=1 back: AT+CMGR=1
OK

error0`"

1 Like

Hey @finlay297680,

No worries, and thanks for your message!

You can input AT commands using a serial terminal program on your Raspberry Pi that connects to the modem’s serial port. Common tools for this are:

  • minicom
  • screen
  • picocom

Theres plenty of online tutorials that can help you learn how to use any one of these.


This error usually means the modem tried to read SMS message number 1, but there’s no message stored there. That’s totally normal if your SMS inbox is empty.

You can check which messages are stored (if any) by running:

AT+CPMS?

(to check message storage status) and

AT+CMGL="ALL"

(to list all messages).


Next steps to confirm SMS and SIM status

Please try these commands (after connecting to the modem via serial terminal):

AT
AT+CPIN?
AT+CSQ
AT+CREG?
AT+COPS?
AT+CMGF=1

They will tell us if:

  • The modem is responding
  • The SIM card is ready (not PIN locked)
  • Signal strength is good
  • Network registration is successful
  • SMS text mode is enabled

Once you share the responses from these commands, I can help you troubleshoot further.

I was able to send a message through minicom using
AT+CMGS:"+614XXXXXXX"
But I am still running into problems using the provided python code.
The modem is responding, text mode is enabled, and the signal strength is good. However I am receiving:

+SMS FULL
1 Like

Hi Finlay,

It looks like your SIM messages are full - if you run into further issues with the scripts would it be possible to specify the file, and error’s from the REPL?

If you run the commands:
AT+CMGL="ALL" to display all of your SMS’s

WARNING
AT+CMGD=1,4 Deletes all of your SMS’s (not recommended on your personal SIM)

Then when you think you have emptied them:
AT+CPMS? to see the memory status

Liam

I used a SIM7600X G4 HAT on my Raspberry but run into an error while initializing. I followed the tutorial, everything fine so far but when I run the init script (which should be part of the rc.local) I run into errors:

xxxxxxxx@womomon:\~/SIM7600X-4G-HAT-Demo/Raspberry/c $ sh sim7600_4G_hat_init
sim7600_4G_hat_init: 1: echo: echo: I/O error
sim7600_4G_hat_init: 3: cannot create /sys/class/gpio/gpio4/direction: Directory nonexistent
sim7600_4G_hat_init: 4: cannot create /sys/class/gpio/gpio4/value: Directory nonexistent
sim7600_4G_hat_init: 5: echo: echo: I/O error
sim7600_4G_hat_init: 7: cannot create /sys/class/gpio/gpio6/direction: Directory nonexistent
sim7600_4G_hat_init: 8: cannot create /sys/class/gpio/gpio6/value: Directory nonexistent

When I list the directory I see the following:

xxxxxxxx@womomon:\~/SIM7600X-4G-HAT-Demo/Raspberry/c $ ls /sys/class/gpio/
export  gpiochip512  gpiochip566  unexport

Does anyone has solved the same problem or have an idea what to do?

Thanks
Rene

Hi there, @Rene306428, and welcome to the forum, glad to have you here.

That’s definitely a strange error. I’m wondering if this might be a permissions issue.The fact that the script is reading ‘Directory nonexistent’ makes me think that the script doesn’t have necessary permissions to read /sys/class/gpio/.

Can you confirm that you previously ran the command:

sudo chmod 777 -R /home/pi/SIM7600X-4G-HAT-Demo

With a particular attention to that -R option since that would then apply to all folders beneath it.

The output of the below command should indicate its permissions:

ls -lh ~/SIM7600X-4G-HAT-Demo/Raspberry/c

Hi Jane

Thanks for your reply. Yes I run this without any errors. Since I run the init script manual on the cli in the user context this may a reason. I copied the sh …init into the rc.local but then I don’t see any output. The main problem is that I ran into errors while running the next command:

wscadmin@womomon:~/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835 $ chmod +x configure && ./configure && sudo make && sudo make install

The out put ends with the following errors:

…

checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking dependency style of gcc… gcc3
checking for clock_gettime in -lrt… yes
checking for doxygen… no
configure: WARNING: Doxygen not found - continuing without Doxygen support
checking for ranlib… ranlib
checking for gcc… (cached) gcc
checking whether we are using the GNU C compiler… (cached) yes
checking whether gcc accepts -g… (cached) yes
checking for gcc option to accept ISO C89… (cached) none needed
checking dependency style of gcc… (cached) gcc3
checking that generated files are newer than configure… done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make all-recursive
make[1]: Entering directory ‘/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835’
Making all in src
make[2]: Entering directory ‘/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835/src’
gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT bcm2835.o -MD -MP -MF .deps/bcm2835.Tpo -c -o bcm2835.o bcm2835.c
bcm2835.c: In function ‘bcm2835_peri_read’:
bcm2835.c:115:51: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
115 | printf(“bcm2835_peri_read paddr %08X\n”, (unsigned) paddr);
| ^
bcm2835.c: In function ‘bcm2835_peri_read_nb’:
bcm2835.c:155:54: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
155 | printf(“bcm2835_peri_read_nb paddr %08X\n”, (unsigned) paddr);
| ^
bcm2835.c: In function ‘bcm2835_peri_write’:
bcm2835.c:171:63: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
171 | printf(“bcm2835_peri_write paddr %08X, value %08X\n”, (unsigned) paddr, value);
| ^
bcm2835.c: In function ‘bcm2835_peri_write_nb’:
bcm2835.c:202:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
202 | (unsigned) paddr, value);
| ^
bcm2835.c: In function ‘bcm2835_gpio_set_pud’:
bcm2835.c:531:5: error: implicit declaration of function ‘delayMicroseconds’; did you mean ‘bcm2835_delayMicroseconds’? [-Wimplicit-function-declaration]
531 | delayMicroseconds(10);
| ^~~~~~~~~~~~~~~~~
| bcm2835_delayMicroseconds
bcm2835.c: In function ‘bcm2835_init’:
bcm2835.c:1314:38: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1314 | bcm2835_peripherals_base = (uint32_t *)(buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0);
| ^
bcm2835.c:1334:75: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
1334 | bcm2835_peripherals = mapmem(“gpio”, bcm2835_peripherals_size, memfd, (uint32_t)bcm2835_peripherals_base);
| ^
make[2]: *** [Makefile:549: bcm2835.o] Error 1
make[2]: Leaving directory ‘/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835/src’
make[1]: *** [Makefile:352: all-recursive] Error 1
make[1]: Leaving directory ‘/home/wscadmin/SIM7600X-4G-HAT-Demo/Raspberry/c/bcm2835’
make: *** [Makefile:292: all] Error 2