LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-18-2013, 12:58 AM   #1
B Akshay
Member
 
Registered: Sep 2012
Posts: 39

Rep: Reputation: Disabled
Serial Communiction error in Pyvisa


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
 
Old 04-20-2013, 12:06 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
The whole VISA layer seems like quite a heavy hammer for such a small nail. Perhaps try something more modest such as PySerial. Also, try communicating interactively with the device using a serial comm's terminal emulator. In Windows, I guess that would be hyperterminal, or some similar tool. The error message being reported suggests a problem with the serial communications at a low level: 'framing error', which very very rarely occurs repeatably, so I'm going to suggest that the problem is in the VISA layer somewhere, making it difficult diagnose.

--- rod.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error Installing Serial Driver micksulley Linux - Hardware 13 02-03-2010 02:33 PM
Serial console always stuck after EXT3-FS error zman2245 Linux - Server 3 10-20-2009 02:42 AM
[SOLVED] Serial port input/output error john_erlandsson Linux - Newbie 9 07-27-2009 08:47 AM
VMWare 5.5.1 serial number invalid error Tritan Slackware 0 08-02-2006 11:15 AM
serial sync loopback error? mjwnijkamp Linux - Laptop and Netbook 0 05-10-2004 10:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration