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

Timeout and "Transport not connected" after a few readings #11

Open
maniac0s opened this issue Apr 4, 2019 · 6 comments
Open

Timeout and "Transport not connected" after a few readings #11

maniac0s opened this issue Apr 4, 2019 · 6 comments

Comments

@maniac0s
Copy link

maniac0s commented Apr 4, 2019

I am trying to use python with dll_name = "libNurApiRasPi.so"

Based on test2.py I created a little script to read tags.
The connection reads then gets a timeout. Additionally I get
*** Error in `python': double free or corruption (!prev): 0x008e9e60 ***
With NurApiStartSimpleInventoryStream I also a timeout after a while, then it starts reading again until the next timeout.

python@SampoS2K190600757:~$ python new.py
Connected!
Stream Started!
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 15
RSSI        : -65
Scaled Rssi : 37
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG: INFO
Timestamp   : 18
RSSI        : -77
Scaled Rssi : 15
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (4098): Transport not connected
TAG INV: (4098): Transport not connected
TAG INV: (4098): Transport not connected
TAG INV: (4098): Transport not connected
^Cinterrupted!
*** Error in `python': double free or corruption (!prev): 0x008e9e60 ***
Aborted

The script:

#(old test2.py above)
theSetup = NUR_SIMPLESETUP()
theCaps = DEVICECAPS()
ri = NUR_READERINFO()
inv =  NUR_INVENTORY_RESPONSE()
tags = NUR_TAG_DATA()
tagsAdded = 0
tagCount = 0

NURLib = CDLL(dllabspath)
hApi = NURLib.NurApiCreate()
port = '/dev/ttyACM0'.encode("utf-8")
strBuf = create_string_buffer(1000)
maxBufLen = sys.getsizeof(strBuf) - 1

error = NURLib.NurApiConnectSerialPortEx(hApi, port, 115200)

NURLib.NurApiGetErrorMessage(error, strBuf, maxBufLen)

if error != 0:
        print("Connect: " + str(error) + ": " + strBuf.value)
        exit()
else:
        print("Connected!")

#error = NURLib.NurApiStartSimpleInventoryStream(hApi)
error = NURLib.NurApiStartInventoryStream(hApi, 0, 0, 0)

NURLib.NurApiGetErrorMessage(error, strBuf, maxBufLen)
if error != 0:
        print("Inventory Stream: " + str(error) + ": " + strBuf.value)
        exit()
else:
        print("Stream Started!")

try:
        while True:
                error = NURLib.NurApiClearTags(hApi)
                error = NURLib.NurApiInventory(hApi,0,0,0, byref(inv))
                error = NURLib.NurApiFetchTags(hApi, True, tagsAdded)
                NURLib.NurApiGetErrorMessage(error, strBuf, maxBufLen)
                print("TAG INV: (" + str(error) + "): " + strBuf.value)

                if error==0:
                        dumpInvResp(inv)

                        for x in range(0,inv.numTagsFound):
                                szObject = sys.getsizeof(NUR_TAG_DATA_EX)
                                error = NURLib.NurApiGetTagDataEx(hApi, x, byref(tags), szObject)
                                dumpTagInfo(tags)

                time.sleep(1)

except KeyboardInterrupt:
    print('interrupted!')
    NURLib.NurApiDisconnect(hApi)
    NURLib.NurApiFree(hApi)
    exit()
#               testRFID()```
@maniac0s
Copy link
Author

maniac0s commented Apr 4, 2019

With NurApiStartSimpleInventoryStream. Please note, that I did not move the tags during the tests, it sometimes reads no tag, then it returns error == 0 but reports 0 tags found then it reads one tag but not the other and sometime it loses transport connection completely after a timeout.

Connected!
Stream Started!
TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 18
RSSI        : -65
Scaled Rssi : 37
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG: INFO
Timestamp   : 21
RSSI        : -76
Scaled Rssi : 17
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 15
RSSI        : -78
Scaled Rssi : 13
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG: INFO
Timestamp   : 19
RSSI        : -65
Scaled Rssi : 37
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 0
Tags mem   : 0
Rounds     : 0
Collisions : 0
Q          : 0

TAG INV: (32): No tag(s) found
TAG INV: (4099): Transport timeout
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 18
RSSI        : -64
Scaled Rssi : 39
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 16
RSSI        : -78
Scaled Rssi : 13
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG: INFO
Timestamp   : 22
RSSI        : -65
Scaled Rssi : 37
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 4
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 17
RSSI        : -65
Scaled Rssi : 37
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A012211105F69

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
^C^C^C^C^C^C^Cinterrupted!
*** Error in `python': double free or corruption (!prev): 0x00f0ee90 ***
Aborted

@maniac0s
Copy link
Author

maniac0s commented Apr 4, 2019

Another run, using NurApiStartInventoryStream, 2 Tag, not moving the tag at all.

python@SampoS2K190600757:~$ python new.py
Connected!
Stream Started!
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 15
RSSI        : -79
Scaled Rssi : 11
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG: INFO
Timestamp   : 24
RSSI        : -48
Scaled Rssi : 68
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A02781120F28B

TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 23
RSSI        : -48
Scaled Rssi : 68
Freq at     : 867500
PC          : 0x3000
CHANNEL     : 3
Antenna ID  : 0
EPC Len     : 12
EPC         : E200001A020A02781120F28B

TAG INV: (32): No tag(s) found
TAG INV: (4099): Transport timeout
TAG INV: (32): No tag(s) found
TAG INV: (4099): Transport timeout
TAG INV: (4099): Transport timeout
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 0
Tags mem   : 0
Rounds     : 0
Collisions : 0
Q          : 0

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
^Cinterrupted!
*** Error in `python': double free or corruption (!prev): 0x00f91e60 ***
Aborted

@mikkonid
Copy link
Contributor

mikkonid commented Apr 5, 2019

Hi,

Try not to call NurApiStartInventoryStream at all.
Streaming inventories sends tags buffer through Nurapi notification callback.

NurApiInventory is another (sync) way to perform inventory. Cannot use both at the same time.

Let me know if this helps.

BR,
Mikko

@maniac0s
Copy link
Author

maniac0s commented Apr 5, 2019

Hello!

It was suggested to my by email to use NurApiStartInventoryStream: "For continuous read you can use the following NurApiStartInventoryStream function:

error = NurApiStartInventoryStream(hApi, 0, 0, 0);
"

I tried to run the same script with NurApiStartInventoryStream and NurApiStartSimpleInventoryStream commented out. It detected a few times then got timeouts again.

Connected!
Stream Started!
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 17
RSSI        : -78
Scaled Rssi : 13
Freq at     : 866300
PC          : 0x3000
CHANNEL     : 1
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 16
RSSI        : -80
Scaled Rssi : 10
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 17
RSSI        : -79
Scaled Rssi : 11
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 22
RSSI        : -78
Scaled Rssi : 13
Freq at     : 867500
PC          : 0x3000
CHANNEL     : 3
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 22
RSSI        : -81
Scaled Rssi : 8
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (4099): Transport timeout
^Cinterrupted!
*** Error in `python': double free or corruption (!prev): 0x01dd0a88 ***
Aborted
python@SampoS2K190600757:~$ python new.py
Connected!
Stream Started!
TAG INV: (32): No tag(s) found

TAG INV: (4099): Transport timeout
^Cinterrupted!

Nothing changed, it detects a few times then it gets timeouts then detects no tags at all (even with tags in range) then it detects again...

@mikkonid
Copy link
Contributor

mikkonid commented Apr 8, 2019

What device you're using?
EDIT: Just noticed "python@SampoS2K190600757" in log :) So following comment is valid.

In case this is smart reader platform (Sampo S2, AR8x), you are not supposed to connect directly to the NUR module "/dev/ttyACM0", instead connection must be made to reader NUR service @ "localhost:4333".

  • Mikko

@maniac0s
Copy link
Author

maniac0s commented Apr 10, 2019

Thank you.

I used the python that was send to me. Is there any documentation on this?
I found this link https://www.developpez.net/forums/attachments/p146192d1400427298/c-cpp/c/piloter-lecteur-rfid/nurapi__2.txt/ and in there NurApiConnectSocket which I called using
error = NURLib.NurApiConnectSocket(hApi, '127.0.0.1', 4333)

The tag detection however seems quite unstable sometimes it detects no tags sometime it detects one and sometimes two. The transport timeout disappeared however.

Is there a whay to optimize detection, what methods of NURLib could I try to get better detection rates?

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 14
RSSI        : -76
Scaled Rssi : 17
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 20
RSSI        : -50
Scaled Rssi : 64
Freq at     : 867500
PC          : 0x3000
CHANNEL     : 3
Antenna ID  : 0
EPC Len     : 12
EPC         : 3005FB63AC1F3681EC880468

TAG INV: (32): No tag(s) found
TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 2
Tags mem   : 2
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 17
RSSI        : -77
Scaled Rssi : 15
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG: INFO
Timestamp   : 18
RSSI        : -49
Scaled Rssi : 66
Freq at     : 866900
PC          : 0x3000
CHANNEL     : 2
Antenna ID  : 0
EPC Len     : 12
EPC         : 3005FB63AC1F3681EC880468

TAG INV: (0): Call succeeded
Inventory Response:
Tags Found : 1
Tags mem   : 1
Rounds     : 2
Collisions : 0
Q          : 7

TAG: INFO
Timestamp   : 23
RSSI        : -78
Scaled Rssi : 13
Freq at     : 865700
PC          : 0x3000
CHANNEL     : 0
Antenna ID  : 0
EPC Len     : 12
EPC         : 30396062C3ACF00000729EEB

TAG INV: (32): No tag(s) found
TAG INV: (32): No tag(s) found
^Cinterrupted!
*** Error in `python': double free or corruption (!prev): 0x013daf70 ***
Aborted

(The tags where placed at a distance of ~1m from the device, the python script still sleeps .5 second between read attempts).

PS: I saw the unstable detection rate with the Java Example too, but there I thought it might be the tags that were flooded by the detection so I ordered a few from a different manufactor but that didn't change the issue much. The same behaviour I see with the Windows Demo App btw. What could I read to learn how to optimize this? The first 4 "No Tags found" all have a .5 second sleep time and that means, that there are 2 seconds of no detection with a tag laying 1m near the device. That's quite long.

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