https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=224355&p=1607546&hilit=sim7600#p1604522
Re: 4G Hat
Fri Sep 20, 2019 2:55 pmHey guys,
I really get nothing to work with my 4G Hat.
Here is what I’ve done so far:
1. Inserted my SIM-Card, connected the antenna to “Main”, connected the hat via GPIO pins to my Raspberry Pi 3B+ without any USB cable connected to the hat. I left the two yellow jumpers factory-default like, centered just as pictured in the manual: https://www.waveshare.com/w/upload/6/6d … ual-EN.pdf
2. Booted the raspberry, set via raspi-config the serial options as described in the manual(no, then yes), rebooted.
3 chmod 777 for sim7600_4G_hat_init and added
sh /home/…/sim7600_4G_hat_init to rc.local4. Rebooted, installed minicom, started sudo minicom -D /dev/ttyS0 and nothing happens and it does not even react on any keystroke.
I even compiled the bcm2835 directory and the phoncecall-demo. When I try to sudo ./Phonecall it says:“Failed to get byte count on serial.”Both LEDs shine red continuously. What am I doing wrong?
Dear!
I do not now that you solved the problem or not yet, but i had exactly the same problem.
The device works perfectly when i plugged on to the USB only (not used as a hat). (In this mode i had to push the power button for a second to power up the module, and the NET led flashes as expected)
used pppd and chatscript to connect
When i put it on the raspberry via gpio (as hat), the NET led shine continuously.
The manual contains a mistake.
It says put init your file to /home/pi/.
and says
add this line to rc.local before “exit 0”
your end of file should look like
Code: Select all
...
fi
sh /home/pi/SIM7600X/sim_7600_4G_hat_init
exit 0
The problem is that your init file is here
/home/pi/sim7600_4G_hat_init
and the
rc.local points to
/home/pi/SIM7600/sim7600_4G_hat_init
and cannot run this script and will not prepare your gpios.
In common the gpios are “floating”.
The script is important because it prepares your 4 and 6 gpio to down.
If you open the init file it contains instructions for the gpios.
This runs when the device boots.
So you only have to correct the path to your init file.
When you reboot next your pi, then the NET led should blink
I did the same way and works.
One more thing:
You can check it with minicom
Download minicom
minicom -s
port settings -> A
set to ttyS0
Enter
Enter
Exit
type “AT”
gives “OK”
type “ATI”
gives similar to ”
Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600E-H
Revision: SIM7600M22_V1.1
IMEI: ***************
+GCAP: +CGSM
OK
”
type “AT+CSQ”
gives
“+CSQ: 20,99
OK”
if something is wrong with the module or with the gpio config the previous command gives:
“+CSQ: 99,99
OK”
the first number gives the rssi, if this is 99 it means that the signal strength is not known or unavailable
another sign of wrong module operation
type “AT+CREG?”
gives ”
+CREG: 0,1
OK”
if something wrong with the module or with the gpio config the previosu command gives:
”
+CREG: 0,0
OK”
the second number says that the module is registered on a network or not 1 means yes 0 means no
this should be 1 even if you not connected to the Internet (this is the mobile network)
for more information you can read AT commands manual
https://www.waveshare.com/w/upload/5/54 … _V1.08.pdf
I hope helped you!
Re: 4G Hat
Hi all
Firstly, thanks for the great resources in this thread. I don’t think I would have managed to get this working without them.
I’ve used the following set of commands to get the HAT running on a PI configured as wireless access point:
Code: Select all
#!/bin/bash
sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'
sudo ip link set wwan0 down # change the wwan0 to the one returned above if different
echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
sudo ip link set wwan0 up
sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='internet',ip-type=4" --client-no-release-cid
sudo udhcpc -i wwan0
I can run the above at boot, both via rc.local and via @reboot in crontab.
However, no matter what happens, I don’t get an IP lease until I manually issue
Code: Select all
sudo udhcpc -i wwan0
. Once I get the lease, everything works 100% and wireless clients connected to the Pi AP can access the internet.
I’ve also tried using the code here by adding the commands to the wwan0 interface file, which in many cases don’t work at all (although I have a feeling that I have forgotten to issue the
Code: Select all
qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'
instruction first).
I have also tried adding
Code: Select all
post-up /sbin/udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i wwan0
to the wwan0 interface file with no success.
So basically, my question is am I missing some config for getting udhcpc to run at boot time after the wwan0 interface is up and connected?
Re: 4G Hat
arnolddozsa90 wrote: ↑
Sat Feb 01, 2020 7:49 amFri Sep 20, 2019 2:55 pmHey guys,
I really get nothing to work with my 4G Hat.
Here is what I’ve done so far:
1. Inserted my SIM-Card, connected the antenna to “Main”, connected the hat via GPIO pins to my Raspberry Pi 3B+ without any USB cable connected to the hat. I left the two yellow jumpers factory-default like, centered just as pictured in the manual: https://www.waveshare.com/w/upload/6/6d … ual-EN.pdf
2. Booted the raspberry, set via raspi-config the serial options as described in the manual(no, then yes), rebooted.
3 chmod 777 for sim7600_4G_hat_init and added
sh /home/…/sim7600_4G_hat_init to rc.local4. Rebooted, installed minicom, started sudo minicom -D /dev/ttyS0 and nothing happens and it does not even react on any keystroke.
I even compiled the bcm2835 directory and the phoncecall-demo. When I try to sudo ./Phonecall it says:“Failed to get byte count on serial.”Both LEDs shine red continuously. What am I doing wrong?
Dear!
I do not now that you solved the problem or not yet, but i had exactly the same problem.
The device works perfectly when i plugged on to the USB only (not used as a hat). (In this mode i had to push the power button for a second to power up the module, and the NET led flashes as expected)
used pppd and chatscript to connectWhen i put it on the raspberry via gpio (as hat), the NET led shine continuously.
The manual contains a mistake.
It says put init your file to /home/pi/.
and says add this line to rc.local before “exit 0”
your end of file should look likeCode: Select all
... fi sh /home/pi/SIM7600X/sim_7600_4G_hat_init exit 0
The problem is that your init file is here /home/pi/sim7600_4G_hat_init
and the rc.local points to /home/pi/SIM7600/sim7600_4G_hat_init
and cannot run this script and will not prepare your gpios.In common the gpios are “floating”.
The script is important because it prepares your 4 and 6 gpio to down.
If you open the init file it contains instructions for the gpios.
This runs when the device boots.So you only have to correct the path to your init file.
When you reboot next your pi, then the NET led should blink
I did the same way and works.
One more thing:
You can check it with minicom
Download minicomminicom -s
port settings -> A
set to ttyS0
Enter
Enter
Exit
type “AT”
gives “OK”
type “ATI”
gives similar to ”
Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600E-H
Revision: SIM7600M22_V1.1
IMEI: ***************
+GCAP: +CGSMOK
”
type “AT+CSQ”
gives
“+CSQ: 20,99OK”
if something is wrong with the module or with the gpio config the previous command gives:
“+CSQ: 99,99OK”
the first number gives the rssi, if this is 99 it means that the signal strength is not known or unavailableanother sign of wrong module operation
type “AT+CREG?”
gives ”
+CREG: 0,1OK”
if something wrong with the module or with the gpio config the previosu command gives:
”
+CREG: 0,0OK”
the second number says that the module is registered on a network or not 1 means yes 0 means no
this should be 1 even if you not connected to the Internet (this is the mobile network)
for more information you can read AT commands manual
https://www.waveshare.com/w/upload/5/54 … _V1.08.pdfI hope helped you!
hello i’ve try it but it error
chmod: cannot access ‘sim7600_4G_hat_init’: No such file or directory
i done copy and paste the demo at /home/pi/SIM7600X/sim7600_4G_hat_init
. when i want to type the AT command at minicom it become freeze. i cant type anything there. can you help me. i really need anyone help. i really new with rpi and this sim7600 T^T
- Posts: 2
- Joined: Thu Feb 06, 2020 5:16 pm
Re: 4G Hat
This is great and I got it working. Do you have anything like this for the getting the GPS/GNS working?
mkrzysztofowicz wrote: ↑
Wed Apr 03, 2019 11:35 amOK, I’ve got this working fully now!
For those of you who are still struggling, here’s the required steps:
1. Install required software
Code: Select all
pi:~$ sudo apt-get update && sudo apt-get install libqmi-utils udhcpc
2. This one is important – when you reboot the pi, the SIM7600 module’s cellular radio is OFF and needs to be turned ON before you can see the mobile network. One way is to use a script which pulls the GPIO pin 4 LOW for a second or two (as per this post: viewtopic.php?t=206761#p1368015), but a more elegant way I think is to use the newly installed qmi utils:
Code: Select all
pi:~$ sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'
Note, you can verify if your radio needs to be turned on by using the following commands:
Code: Select all
qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength qmicli -d /dev/cdc-wdm0 --nas-get-home-network
If the first command shows in its output ‘Low Power’ or anything other than ‘online’ it means your radio is off and needs to be turned on.
The last of those commands should return the LTE network ID if your device successfully connected.3. Reconfigure the network interface for raw-ip protocol
The qmi-wwan kernel driver creates the wwan0 network interface for you when it detects the SIM7600 module connected to your Raspberry Pi. By default that interface is set to 802-3 protocol, however it seems the correct protocol should be raw-ip. The qmi-network script tries to set that up for you, but it will most likely fail. To make the change, do the following:
Code: Select all
pi:~$ sudo qmicli -d /dev/cdc-wdm0 -w # this confirms the name of the network interface, typically wwan0 pi:~$ sudo ip link set wwan0 down # change the wwan0 to the one returned above if different pi:~$ echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip pi:~$ sudo ip link set wwan0 up
4. Connect to the mobile network.
After having done all the above, when trying to use qmicli to connect, I was getting the following error: error: “couldn’t start network: QMI protocol error (64): ‘(null)’. .
There have apparently been some changes to qmi utils in Stretch and most of the documentation I saw over the last days is almost correct but missing one vital detail – you need to add ip-type=4 to other parameters for qmicli -d /dev/cdc-wdm0 –wds-start-network= as below.
Code: Select all
pi:~$ qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='YOUR_APN',username='YOUR_USERNAME',password='YOUR_PASSWORD',ip-type=4" --client-no-release-cid [/dev/cdc-wdm0] Network started Packet data handle: '2264328160' [/dev/cdc-wdm0] Client ID not released: Service: 'wds' CID: '20'
5. Finally, configure the IP address and the default route with udhcpc:
Code: Select all
pi:~$ sudo udhcpc -i wwan0 udhcpc (v1.22.1) started No resolv.conf for interface wwan0.udhcpc Sending discover... Sending select for 10.65.52.178... Lease of 10.65.52.178 obtained, lease time 7200 cat: /run/resolvconf/lock/pid: No such file or directory /sbin/resolvconf: 733: kill: Illegal number: clearing stale lock pid Too few arguments. Too few arguments.
As you can see, this spits out a number of errors, but they relate to configuration of DNS servers in your resolv.conf file, but otherwise this works and I can now get the connection via the mobile network:
Code: Select all
pi:~ $ ip a s wwan0 3: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000 link/none inet 10.65.52.178/30 scope global wwan0 valid_lft forever preferred_lft forever pi:~ $ ip r s default via 10.65.52.177 dev wwan0 10.65.52.176/30 dev wwan0 proto kernel scope link src 10.65.52.178 192.168.100.0/24 dev eth0 proto kernel scope link src 192.168.100.5 metric 202 pi:~ $ ping -4 www.google.com PING www.google.com (74.125.193.147) 56(84) bytes of data. 64 bytes from ig-in-f147.1e100.net (74.125.193.147): icmp_seq=1 ttl=50 time=732 ms 64 bytes from ig-in-f147.1e100.net (74.125.193.147): icmp_seq=2 ttl=50 time=79.4 ms 64 bytes from ig-in-f147.1e100.net (74.125.193.147): icmp_seq=3 ttl=50 time=80.3 ms 64 bytes from ig-in-f147.1e100.net (74.125.193.147): icmp_seq=4 ttl=50 time=79.4 ms ^C --- www.google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 79.447/242.945/732.530/282.662 ms
You can take a look at this article: http://www.embeddedpi.com/documentation … face-setup for a way to tidy things up a bit. It refers to a different 3G/4G modem (Sierra Wireless) but the way they set interfaces up and everything else still applies.
Good luck!
Re: 4G Hat
Taught i would give you some advice to ease your life a bit. I had my share of troubles making these modem work. Days of pulling my hair out.
I’m using a sim7000g pcie with a usb adapter wich is more or less the same, and using the QMI WAN means running some script to connect or doing it manually. Not the best for me as i have a few dozen of them in the field left unatended and it need to connect back itself after a power loss or a reset.
I was using Huawei E-303 in Hilink mode before. Great modem, with usb-modeswitch being part of raspbian, you plug the thing and it work. Period. I needed something like this in Lte Cat1.
So the trick to make this modem being recognised as an ethernet adapter is to change it’s mode with the AT+CECMMODE=1 command. This obscure command is not even published by Simcom themselfes, ask me why.
Starting with a fresh install of raspbian, plug your modem in a USB port with a valid sim card. enter lsusb -t, it will show you this:
[codepi@raspberrypi:~ $ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 3, If 1, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 3, If 2, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 3, If 3, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 3, If 4, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 3, If 5, Class=Vendor Specific Class, Driver=qmi_wwan, 480M][/code]
Now with minicom installed start it with this: sudo minicom -D /dev/ttyUSB3
enter your apn if not set: AT+CGDCONT=1,”IP”,”yourapn”
Now with a valid sim card in the modem (important or it will not work) enter this command: AT+CECMMODE?
It will tell you +CECMMODE=0
Enter: AT+CECMMODE=1
Now check again with AT+CECMMODE?
It will be: +CECMMODE=1
Now check with lsusb -t, it should be now a cdc_ether device
Code: Select all
pi@raspberrypi:~ $ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 4, If 0, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 4, If 1, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 4, If 2, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 4, If 3, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 4, If 4, Class=Vendor Specific Class, Driver=option, 480M
|__ Port 1: Dev 4, If 5, Class=Communications, Driver=cdc_ether, 480M
|__ Port 1: Dev 4, If 6, Class=CDC Data, Driver=cdc_ether, 480M
And you should have interwebs right away. Type ifconfig and your modem should be listed as eth0 (if you have a pi zero) or eth1.
Ping google: ping -I eth0 8.8.8.8
That’s all, nothing else to do.
Re: 4G Hat
Hi…
Has anyone managed to get a 4g connection (using mkrzysztofowicz instructions… thanks by the way! ) and gps running through gpsd on boot of the Pi?
I’ve got a crontab script running after boot to bring the wwan down and reconfigure the network interface for raw-ip protocol. This works and gets me a 4g connection but it manages to break GPSD. GPSD is set up to listen on terminal ‘/dev/ttyUSB1’ however when I bring the wwan down and reconfigure it this terminal appears to be locked and when it comes back up my GPS data is coming through on ‘/dev/ttyUSB2’ below is the output from ‘dmesg | grep usb’
Code: Select all
[ 0.105295] usbcore: registered new interface driver usbfs
[ 0.105370] usbcore: registered new interface driver hub
[ 0.105485] usbcore: registered new device driver usb
[ 0.305274] usbcore: registered new interface driver lan78xx
[ 0.307836] usbcore: registered new interface driver smsc95xx
[ 0.340601] dwc_otg 3f980000.usb: base=(ptrval)
[ 0.785535] dwc_otg 3f980000.usb: DWC OTG Controller
[ 0.787817] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1
[ 0.790138] dwc_otg 3f980000.usb: irq 56, io mem 0x00000000
[ 0.797137] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
[ 0.801637] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.804045] usb usb1: Product: DWC OTG Controller
[ 0.806406] usb usb1: Manufacturer: Linux 4.19.97-v7+ dwc_otg_hcd
[ 0.808847] usb usb1: SerialNumber: 3f980000.usb
[ 0.817119] usbcore: registered new interface driver usb-storage
[ 0.848775] usbcore: registered new interface driver usbhid
[ 0.851405] usbhid: USB HID core driver
[ 1.237035] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 1.477335] usb 1-1: New USB device found, idVendor=0424, idProduct=9514, bcdDevice= 2.00
[ 1.482647] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1.807035] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 1.937329] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00, bcdDevice= 2.00
[ 1.942792] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.040667] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:98:bf:20
[ 2.137050] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 2.290256] usb 1-1.3: New USB device found, idVendor=1e0e, idProduct=9001, bcdDevice= 3.18
[ 2.296668] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2.300180] usb 1-1.3: Product: SimTech, Incorporated
[ 2.303550] usb 1-1.3: Manufacturer: SimTech, Incorporated
[ 2.307036] usb 1-1.3: SerialNumber: 0123456789ABCDEF
[ 5.165678] usbcore: registered new interface driver brcmfmac
[ 5.193777] usbcore: registered new interface driver usbserial_generic
[ 5.193856] usbserial: USB Serial support registered for generic
[ 5.200224] usbcore: registered new interface driver cdc_wdm
[ 5.216489] usbcore: registered new interface driver option
[ 5.216569] usbserial: USB Serial support registered for GSM modem (1-port)
[ 5.229495] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 5.231424] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB1
[ 5.232501] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 5.235632] qmi_wwan 1-1.3:1.5 wwan0: register 'qmi_wwan' at usb-3f980000.usb-1.3, WWAN/QMI device, 26:21:06:a9:dc:56
[ 5.235992] usbcore: registered new interface driver qmi_wwan
[ 5.236627] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 5.257189] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
[ 29.362352] usb 1-1.3: USB disconnect, device number 4
[ 29.366945] qmi_wwan 1-1.3:1.5 wwan0: unregister 'qmi_wwan' usb-3f980000.usb-1.3, WWAN/QMI device
[ 35.537055] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[ 35.680009] usb 1-1.3: New USB device found, idVendor=1e0e, idProduct=9001, bcdDevice= 3.18
[ 35.680026] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 35.680036] usb 1-1.3: Product: SimTech, Incorporated
[ 35.680046] usb 1-1.3: Manufacturer: SimTech, Incorporated
[ 35.680055] usb 1-1.3: SerialNumber: 0123456789ABCDEF
[ 35.682245] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB0
[ 35.683847] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB2
[ 35.685215] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB3
[ 35.686397] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB4
[ 35.688779] usb 1-1.3: GSM modem (1-port) converter now attached to ttyUSB5
[ 35.698582] qmi_wwan 1-1.3:1.5 wwan0: register 'qmi_wwan' at usb-3f980000.usb-1.3, WWAN/QMI device, 26:21:06:a9:dc:56
I can manually switch the terminal to ‘dev/ttyUSB2’ in ‘/etc/default/gpsd’ and everything works fine but I need this all to automatically work on boot of my Pi?
Any and all help appreciated. This is the first time I’ve worked with GSM modules so everything is new to me. I’ve tried disabling the gpsd service on boot but this has adverse affects on other services I’m running. Has anyone managed to achieve what I’m trying to do?
.END
Categories: Uncategorized