Hello,
I have writtern a small program to send AT command to the mobile phone.
The code is working fine. But i want to check the response of the AT command from the device i.e "OK". For that i have writtern a as follows,
Code:
ser.write("at")
time.sleep(0.5)
for i in [1,2,3]:
time.sleep(0.10)
resp = ser.read()
print resp
print "\n i = ", i
if resp != "\nOK":
print "NO Response"
elif resp == "\nOK":
print "Fine"
time.sleep(10)
For the first iteration the code is working fine, But for the very next iteration it is giving the error. as follows,
Code:
Iteration -> 1
at
i = 1
i = 2
OK
i = 3
Fine
Iteration -> 2
Traceback (most recent call last):
File "C:\Working_Programs\PROG_D\My_prog.py", line 32, in <module>
resp = ser.read()
File "C:\Python27\lib\site-packages\pyvisa\visa.py", line 433, in read
return self._strip_term_chars(self.read_raw())
File "C:\Python27\lib\site-packages\pyvisa\visa.py", line 407, in read_raw
chunk = vpp43.read(self.vi, self.chunk_size)
File "C:\Python27\lib\site-packages\pyvisa\vpp43.py", line 840, in read
visa_library().viRead(vi, buffer, count, byref(return_count))
File "C:\Python27\lib\site-packages\pyvisa\vpp43.py", line 398, in check_status
raise visa_exceptions.VisaIOError, status
VisaIOError: VI_ERROR_ASRL_FRAMING: A framing error occurred during transfer.
>>>
The baudrate is 115200.
Chunk size is default!!
I am always getting this error while reading the response from the device.
Thanks in advance for your time and input