title: Serial() Parameters to read a PN532 through uart in python
body: <p>So I'm trying to read data from my rfid reader PN532 which is connected to UART on my raspberry pi. The hardware is all connected and should be working properly, because libnfc's example nfc-poll reads my tag and phone, and the nfcpy library can read my phone.</p>
  
  <p>Now I want to write a simple python program to read the serial port '/dev/ttyAMA0' (on which the UART rfid reader works) and retrieve the UID from the data that is read. I can't use the nfcpy library because it doesn't support my MiFare 1k classic card.
  As far as I could read up on, when pip installing pyserial, I could write a program like this to retrieve data from my UART serial port:</p>
  
  <pre><code>import serial
  
  ser = serial.Serial('/dev/ttyAMA0', 115200, timeout=5)
          print("opened {0}" . format(ser.name))
          while True:
                  try:
                          sr = ser.readline()
                          s = sr.decode('utf8')
                          if len(s) == 0:
                                  continue
                          else:
                                  sl = s[1:11] #exclude start x0A and stop x0D bytes
                                  print(sl)
  
                  except Exception as e:
                          print("error: {0}" . format(e))
  </code></pre>
  
  <p>But when I remote-debug with visual studio sr keeps being <code>b''</code> and thus the decode results in an empty string. </p>
  
  <p>Are my parameters for serial.Serial() wrong? Or does this method just not work for a PN532?  Or is something else amiss?
  Any help is much appreciated.</p>