Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeoutException with Sim800 module #102

Open
HamidMousavi-git opened this issue Apr 28, 2022 · 1 comment
Open

TimeoutException with Sim800 module #102

HamidMousavi-git opened this issue Apr 28, 2022 · 1 comment

Comments

@HamidMousavi-git
Copy link

Hi
I want to test this library with Sim800 module but it raise timeout exception
i test the module with putty and also with below code and every thigs is ok:

`import serial
import time

ser = serial.Serial(port='COM3', baudrate=9600, timeout=3)
ser.write(b"AT\r\n")
time.sleep(1)
ser.write(b'AT+CMGF=1\n\r')
time.sleep(1)
ser.flushInput()
ser.flushOutput()
command = b'AT+CMGL="ALL"\n\r'#gets incoming sms that has not been read -("REC UNREAD","REC READ","STO UNSENT","STO SENT","ALL")
ser.write(command)
time.sleep(1)
print('ser.inWaiting(): {0}'.format(ser.inWaiting()))
print(ser.read_all())
while ser.inWaiting():
print(ser.read_all())
ser.close() `

but when i run identify-modem.py or other examples it raise timeout exception

python.exe c:/Users/Hamid/Desktop/python-gsmmodem-master/tools/identify-modem.py COM3 -b 9600 -d
args: Namespace(port='COM3', baud='9600', pin=None, debug=True, wait=0)
Connecting to GSM modem on COM3...
Traceback (most recent call last):
File "c:\Users\Hamid\Desktop\python-gsmmodem-master\tools\identify-modem.py", line 90, in
main()
File "c:\Users\Hamid\Desktop\python-gsmmodem-master\tools\identify-modem.py", line 51, in main
modem.connect(args.pin, waitingForModemToStartInSeconds=args.wait)
File "C:\Users\Hamid\AppData\Local\Programs\Python\Python310\lib\site-packages\gsmmodem\modem.py", line 211, in connect
self.write('ATZ') # reset configuration
File "C:\Users\Hamid\AppData\Local\Programs\Python\Python310\lib\site-packages\gsmmodem\modem.py", line 464, in write
responseLines = super(GsmModem, self).write(data + writeTerm, waitForResponse=waitForResponse, timeout=timeout, expectedResponseTermSeq=expectedResponseTermSeq)
File "C:\Users\Hamid\AppData\Local\Programs\Python\Python310\lib\site-packages\gsmmodem\serial_comms.py", line 144, in write
raise TimeoutException()
gsmmodem.exceptions.TimeoutException: None

@t-rekttt
Copy link

I found out that change dsrdtr and/or rtscts to false in this line will fix it.
Specifically:
dsrdtr = false, rtscts = false: Working
dsrdtr = true, rtscts = false: Working
dsrdtr = false, rtscts = true: Not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants