sbcshop / Pitalk_4G_HAT_Software

The PiTalk 4G HAT is a handy, low-power Raspberry Pi HAT that features multi-communication functionalities such as GSM, GPRS, TCP, etc. It allows your Pi to easily make phone calls, send messages, connect to wireless networks, and so on. It is the most convenient IoT HAT that works with all variants of Raspberry Pi (model A, B and Zero). The users
MIT License
7 stars 4 forks source link

Unable to get modem to work on Raspberry Pi 5 #2

Open ncul777 opened 3 weeks ago

ncul777 commented 3 weeks ago

I've connected the PiTalk 4G HAT to a Raspberry Pi 5 but haven't managed to get it working as yet (Some things appear to be different on the Pi 5)

Setup

Raspberry Pi 5 8 GB

python3 (3.11.2) already installed, along with python3-rpi.gpio (0.7.1~a4-1+b4) I had to run sudo apt install python3-serial

Using raspi-config to enable serial. The parameter in the config is different.

cat /boot/firmware/config.txt shows

[all]
dtparam=uart0=on

I rebooted, and pressed the button on the modem for 4 or 5 seconds but no other LED turns on (The RED POWER LED is on, but the STATUS LED is not.)

According to other articles the serial port is likely to be /tty/AMA0. If I change that in the PiTalk_4G.py (line 6 and 15) and then run the GPS example sudo python GPS.py

I get the following error:

  File "/home/guardian/PiTalk_4G.py", line 121, in gps_positioning
    self.power_on(power_key)
  File "/home/guardian/PiTalk_4G.py", line 22, in power_on
    self.GPIO.setup(power_key,self.GPIO.OUT)
RuntimeError: Cannot determine SOC peripheral base address

Happy to provide any other info needed or run other tests.

Any help much appreciated.

ncul777 commented 3 weeks ago

On Raspberry Pi 4B, running the script was more promising (ttyS0). The NETLIGHT LED flashes but STATUS not.

EG25-G is starting:
EG25-G is ready
Starting GPS session...
AT+CGPS=1,1 ERROR
AT+CGPS=1,1 back:   AT+CGPS=1,1
ERROR

AT+CGPSINFO ERROR
AT+CGPSINFO back:   AT+CGPSINFO
ERROR

error 0
AT+CGPS=0 ERROR
AT+CGPS=0 back: AT+CGPS=0
ERROR

Finally using socat I was able to get data back

socat -d -d file:/dev/ttyS0,b115200,raw,echo=0,crnl file:/dev/tty

AT
AT
OK
AT+QGMR
EG25GGBR07A08M2G_01.001.01.001
ncul777 commented 3 days ago

I tested the update provided by support for PI 5 and it works fine. (this uses gpiozero instead of RPi.GPIO)

Note: Suggest to detect which PI model it is running on and set the serial port accordingly – If model 5 use /dev/ttyAMA0 otherwise use /dev/ttyS0. This can be done with the following pi_info command and extracting the model

from gpiozero import pi_info
print(pi_info())

On Raspberry Pi 5: PiBoardInfo(revision='d04170', model='5B', pcb_revision='1.0', released='2023Q4', soc='BCM2712', manufacturer='Sony', memory=8192, storage='MicroSD', usb=4, usb3=2, ethernet=1, eth_speed=1000, wifi=True, bluetooth=True, csi=2, dsi=2, headers=..., board=...)

On Raspberry Pi 4B PiBoardInfo(revision='d03115', model='4B', pcb_revision='1.5', released='2020Q2', soc='BCM2711', manufacturer='Sony', memory=8192, storage='MicroSD', usb=4, usb3=2, ethernet=1, eth_speed=1000, wifi=True, bluetooth=True, csi=1, dsi=1, headers=..., board=...)

Happy to close this issue.