question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PN5180 ListenToCardIso14443TypeA hangup

See original GitHub issue

Don’t know if this is the place to post problems with device bindings. Please let me know if it should be posted somewhere else.

PN5180 ListenToCardIso14443TypeA hangup I am looking into the device binding with the PN5180 to read and write some Mifare 1k classic cards. I noticed that when a Mifare classic card is put in and out of the field the PN5180 stops working and the Busy line of the PN5180 stays high.

Steps to reproduce Call the ListenToCardIso14443TypeA in a loop and hold a Mifare classic 1k card with a UID4 in front of the reader and away again. Repeat this until the hang-up occurs.

Possible fix at line 1036 in Pn5180.cs the anticollision is done.

for (int i = 0; i < 3; i++)
{
    // Select SL1
    uidSak[0] = (byte)(0x93 + i * 2);
    // NVB = Number of valid bits
    uidSak[1] = 0x20;
    SendDataToCard(uidSak.Slice(0, 2));
    // Read 5 bytes sak. Byte 1 will tell us if we have the full UID or if we need to read more
    ReadDataFromCard(sakInterm.Slice(0, 5));

To prevent the hang-up a check if 5 bytes are received would be enough.

for (int i = 0; i < 3; i++)
{
    // Select SL1
    uidSak[0] = (byte)(0x93 + i * 2);
    // NVB = Number of valid bits
    uidSak[1] = 0x20;
    SendDataToCard(uidSak.Slice(0, 2));
    (numBytes, _) = GetNumberOfBytesReceivedAndValidBits();
    if (numBytes != 5)
    {
        return false;   //this will prevent a hangup
    }
    // Read 5 bytes sak. Byte 1 will tell us if we have the full UID or if we need to read more
    ReadDataFromCard(sakInterm.Slice(0, 5));

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
arnoud-koolecontrolscommented, Jul 27, 2020

@Ellerbach I am using a copy of the binding and renamed the namesspace. This made it possible for me to experiment and check the behavior in the original version and the local version. I have used it now for a while and have not yett noticed any hangs anymore, while reading mifare classic 1k cards or connecting to my phone. So I am very pleased with the available binding. 😃

0reactions
krwqcommented, Aug 6, 2020

@arnoud-koolecontrols is this issue already fixed by your PR? Please close it if so… (note: you can put something like Fixes #1139 in first line of PR description, that will auto-close the issue when PR is merged)

Read more comments on GitHub >

github_iconTop Results From Across the Web

PN5180 | NFC IC for POS Solutions
The PN5180 is a high-performance full NFC Forum-compliant frontend IC for various contactless communication methods and protocols.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found