NFC hat over UART can only connect once

Ask questions about Arch Linux ARM. Please search before making a new topic.

NFC hat over UART can only connect once

Postby bjornfelle » Mon Jan 04, 2021 9:59 pm

I've just added a Waveshare NFC hat to a Pi 2 running ALARM. I installed ALARM fresh, installed base-devel and wiringpi, and compiled the sample C code to read the UID from an NFC tag. If there is a tag on the reader when I run the compiled programme, it will output the UID of the tag. If there is no tag present, the programme should stay within a while loop until a tag is presented, but the programme freezes on the line which attempts to read the tag. If I CTRL-C and then re-run the programme I get an error "Failed to detect the PN532". If I reboot and run the programme with no tag present, it will cycle through the loop once, and then get stuck again on the subsequent check so never detects the tag once presented. I have installed a Raspberry Pi OS image and compiled the exact same code, and it works perfectly. Any ideas? Thanks in advance!
bjornfelle
 
Posts: 2
Joined: Mon Jan 04, 2021 9:53 pm

Re: NFC hat over UART can only connect once

Postby bjornfelle » Mon Jan 04, 2021 11:02 pm

This doesn't solve the problem with UART, but I've just reconfigured the hat to use i2c and adjusted the C programme accordingly and it now works just fine. I can run the programme as many times as I need to and it always connects to the hat and reads its state correctly.
bjornfelle
 
Posts: 2
Joined: Mon Jan 04, 2021 9:53 pm

Re: NFC hat over UART can only connect once

Postby summers » Wed Jan 06, 2021 7:58 am

Is the process that opens the uart hanging on exit, and becoming a zombie? "lsof" should show if anything is attached to the uart.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 7 guests