chafon-rfid icon indicating copy to clipboard operation
chafon-rfid copied to clipboard

Getting broken pipe error

Open sharibansari opened this issue 5 years ago • 9 comments

Hi Will,

When I am trying to run a single-read.py in the example I am getting the following error.

File "single-read.py", line 21, in reader_info = ReaderInfoFrame(runner.run(get_reader_info)) File "{PYTHONPATH}:$(pwd)/chafon_rfid/base.py", line 31, in run self.transport.write(command.serialize()) File "{PYTHONPATH}:$(pwd)//chafon_rfid/transport.py", line 33, in write self.write_bytes(byte_array) File "{PYTHONPATH}:$(pwd)//chafon_rfid/transport.py", line 55, in write_bytes self.socket.sendall(byte_array) BrokenPipeError: [Errno 32] Broken pipe

Could you please explain the usage of the examples in brief ?

Thanks

sharibansari avatar Dec 09 '19 07:12 sharibansari

By default the examples try to connect to a reader over the network, but you can also use serial.

The error you are getting BrokenPipeError: [Errno 32] Broken pipe in single-read.py implies that your device is not accessible at the hard-coded IP 192.168.1.190. You need to change this on line 18 to the address of the reader, or use serial communication instead (if your reader is connected that way), e.g.

transport = SerialTransport(device='/dev/ttyUSB0')

Hope that helps

wabson avatar Dec 11 '19 13:12 wabson

Hi Will,

When I am trying to run a single-read.py I am finding this error.

<base.CommandRunner object at 0xb64707f0> Traceback (most recent call last): File "code3.py", line 21, in reader_info = ReaderInfoFrame(runner.run(get_reader_info)) File "/home/pi/chafon-rfid-master/chafon_rfid/base.py", line 32, in run return self.transport.read_frame() File "/home/pi/chafon-rfid-master/chafon_rfid/transport.py", line 28, in read_frame frame_length = length_bytes[0] IndexError: bytearray index out of range

I was used serial communication instead transport e.g. transport = SerialTransport(device='/dev/ttyUSB0')

Could you explain where and how to solve the problem?

Thank you

anas-gif avatar Feb 13 '20 09:02 anas-gif

This : <base.CommandRunner object at 0xb64707f0> is because I have written runner = CommandRunner(transport) print(runner)

anas-gif avatar Feb 13 '20 10:02 anas-gif

@anas-gif normally you should open a separate issue unless you are sure your problem is related. But since I didn't close this issue yet, let's continue here.

Could you post the output of dmesg | grep tty? It may be that /dev/ttyUSB0 is not the correct device name, but the output should indicate which serial ports you have in use.

wabson avatar Feb 13 '20 10:02 wabson

[ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=64M cma=256M video=HDMI-A-1:1920x1080M@60,margin_left=48,margin_right=48,margin_top=48,margin_bottom=48 smsc95xx.macaddr=DC:A6:32:57:19:19 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=tty1 root=PARTUUID=d9b3f436-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles [ 0.000258] console [tty1] enabled [ 0.434975] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 34, base_baud = 0) is a PL011 rev2 [ 0.438246] fe215040.serial: ttyS0 at MMIO 0x0 (irq = 37, base_baud = 62500000) is a 16550 [ 4.914043] usb 1-1.2: cp210x converter now attached to ttyUSB0

anas-gif avatar Feb 13 '20 10:02 anas-gif

I have replaced /dev/ttyUSB0 by /dev/ttyAMA0 and the programme no post nothing.

I connecte my RFID with Raspberry by wires TXD of RFID with RXD of Raspberry and RXD of RFID with TXD of Raspberry. And I connecte my RFID also with Raspberry by cable USB (UHF RFID Desktop Reader and Writer Modèle: CF-RU5202) you can see the http://fr.chafontech.com/rfid-uhf-reader/uhf-reader-and-writer/diy-uhf-rfid-reader.html

anas-gif avatar Feb 13 '20 10:02 anas-gif

can you help me please

anas-gif avatar Feb 13 '20 10:02 anas-gif

Hi @wabson I have the same issue while trying to connect to RU6403 reader via network. In the example single-reader.py I've changed IP address and port of reader and Im getting BrokenPipeError: [Errno 32] Broken pipe on line reader_info = ReaderInfoFrame(runner.run(get_reader_info)).

I checked connectivity using tools included in reader's SDK and successfully connected to reader

I'm not very experienced in TCP connections, so any help in debugging that issue will be very helpful. Screenshot 2020-02-23 at 18 16 14

darklifeform avatar Feb 23 '20 16:02 darklifeform

please try auto_connect=True in transport.py or manually connect with socket.

gmvidooly avatar Nov 23 '20 12:11 gmvidooly