Civlo85 / gsmHat

Using the Waveshare GSM/GPRS/GNSS Hat for Raspberry Pi with Python
MIT License
61 stars 26 forks source link

Cannot receive any data from hat #9

Closed andriensis closed 2 years ago

andriensis commented 2 years ago

Hi! I'm trying out the code but I can't receive any data from my hat.

I'm using the repo example code for fetching the board GPS position.

from gsmHat import GSMHat, SMS, GPS gsm = GSMHat('/dev/ttyS0', 115200) GPSObj = gsm.GetActualGPS() print('GNSS_status: %s' % str(GPSObj.GNSS_status))

Python result:

GNSS_status: 0

And here are the logs:

2021-08-31 07:23:19,639 - gsmHat.gsmHat - INFO - Serial connection to /dev/ttyS0 established 2021-08-31 07:23:19,640 - gsmHat.gsmHat - INFO - Worker started 2021-08-31 07:23:19,641 - gsmHat.gsmHat - DEBUG - Sent to hat: AT+CMGF=1

Just some notes:

It looks like the raspberry may not be communicating the hat.

andriensis commented 2 years ago

An update: it looks like the serial communication is actually working because I see the RX led blinking on my hat when I try to run the python script

andriensis commented 2 years ago

Solved by adding a few seconds sleep after GSMHat initialization

gsm = GSMHat('/dev/ttyS0', 115200) sleep(2) GPSObj = gsm.GetActualGPS()