Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Arduino Zero Errors #10

Open
RatGit opened this issue Apr 9, 2019 · 9 comments
Open

Arduino Zero Errors #10

RatGit opened this issue Apr 9, 2019 · 9 comments

Comments

@RatGit
Copy link

RatGit commented Apr 9, 2019

Hi,

I tried to run this library with an Arduino Zero and this PN5180 Board, but it generates the following error message:

Error in getInventory: No card detected!
IRQ-Status 0x6: [ TX IDLE ]
*** No card detected!

I turned on DEBUG in the "PN5180ISO15693.cpp" file as recommended in one of the other issue threads, but the code would not compile?

_/libraries/PN5180/1.1.0/PN5180ISO15693.h:60:30: error: initializing argument 1 of 'const __FlashStringHelper* PN5180ISO15693::strerror(ISO15693ErrorCode)' [-fpermissive]
const _FlashStringHelper *strerror(ISO15693ErrorCode errno);

What does "No Card Detected" actually mean?

ps. I have ensured that the pins are voltage compatible and that all the other SPI peripherals are deselected. I also set the RST line to HIGH in "setup()" so that the "nfc.reset()" function works properly:

digitalWrite(PN5180_RST, HIGH); // Not Reset, (should modify "nfc::begin()" function to do this instead)

Any help would be greatly appreciated...

@ATrappmann
Copy link
Owner

ATrappmann commented Apr 9, 2019 via email

@RatGit
Copy link
Author

RatGit commented Apr 10, 2019

Hi Andreas,

Thank you for responding to my initial issue submission. I have subsequently decided to proceed with an Arduino Uno instead for my testing.
I duplicated your original wiring connections, (using the Uno with an identical PN5180 board and a 3.3V-5V level shifter) and used the Arduino IDE to compile and upload your library's example sketch.

The software still isn't able to communicate properly with the PN5180 board and eventually "hangs"...

==================================
Uploaded: Apr 10 2019 17:12:31
PN5180 ISO15693 Demo Sketch
----------------------------------
PN5180 Hard-Reset...
----------------------------------
Reading product version...
Product version=3.7
----------------------------------
Reading firmware version...
Firmware version=3.7
----------------------------------
Reading EEPROM version...
EEPROM version=51.0
----------------------------------
Enable RF field...
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #0
Get Inventory...
Issue Command 0x01...
Error in getInventory: ISO15693ErrorCode=-1
No card detected!
IRQ-Status 0x30300: [ TX_RFOFF TX_RFON RX_SC_DET ]
*** No card detected!
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #1
Get Inventory...
Issue Command 0x01...
Error in getInventory: ISO15693ErrorCode=-1
No card detected!
IRQ-Status 0x30100: [ TX_RFOFF RX_SC_DET ]
*** No card detected!
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #2
Get Inventory...
Issue Command 0x01...
RX-Status=00181D7C, len=380

I'm not sure what exactly might be happening here and I am still working on it... I would certainly appreciate any insights you may be able to offer,

Kind Regards,
Keith.

@ATrappmann
Copy link
Owner

ATrappmann commented Apr 10, 2019 via email

@RatGit
Copy link
Author

RatGit commented Apr 11, 2019

Hi Andreas,

Thank you for responding to my initial issue submission. I have subsequently decided to proceed with an Arduino Uno instead for my testing.
I duplicated your original wiring connections, (using the Uno with an identical PN5180 board and a 3.3V-5V level shifter) and used the Arduino IDE to compile and upload your library's example sketch.

The software still isn't able to communicate properly with the PN5180 board and eventually "hangs"...

==================================
Uploaded: Apr 10 2019 17:12:31
PN5180 ISO15693 Demo Sketch
----------------------------------
PN5180 Hard-Reset...
----------------------------------
Reading product version...
Product version=3.7
----------------------------------
Reading firmware version...
Firmware version=3.7
----------------------------------
Reading EEPROM version...
EEPROM version=51.0
----------------------------------
Enable RF field...
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #0
Get Inventory...
Issue Command 0x01...
Error in getInventory: ISO15693ErrorCode=-1
No card detected!
IRQ-Status 0x30300: [ TX_RFOFF TX_RFON RX_SC_DET ]
*** No card detected!
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #1
Get Inventory...
Issue Command 0x01...
Error in getInventory: ISO15693ErrorCode=-1
No card detected!
IRQ-Status 0x30100: [ TX_RFOFF RX_SC_DET ]
*** No card detected!
Loading RF-Configuration...
done.
Turning ON RF field...
done.
----------------------------------
Loop #2
Get Inventory...
Issue Command 0x01...
RX-Status=00181D7C, len=380

I'm not sure what exactly might be happening here and I am still working on it... I would certainly appreciate any insights you may be able to offer,

ps. I did notice that card was detected, however there was no card actually near the device?

Kind Regards,
Keith.

@RatGit
Copy link
Author

RatGit commented Apr 11, 2019

Hi Andreas,

I now have it all working on both the Uno and Zero devices... The level shifter boards I was using were broken. I am using the Sloeber Arduino Eclipse plugin as my development environment with an Atmel ICE, so I have hardware debugging working under Linux. (Note: You can also do this under Windows with Sloeber and Atmel Studio).

FYI: I am currently modifying the test code to support multiple devices hosted by the same Arduino.

Kind Regards,
Keith.

@ATrappmann
Copy link
Owner

ATrappmann commented Apr 11, 2019 via email

@RatGit
Copy link
Author

RatGit commented Apr 12, 2019

Hi Andreas,

FYI: I've managed to modify the library to work with multiple PN5180 Reader/Writers. During this process I've modified your Library and Example sketch to support this, (see the attached Zip archive: PN5180.zip).
[Note: I've converted your Arduino sketch file to a C++ module and associated header file.]

The library changes include the following:

  • Remove call to "SPI.begin" from the "PN5180::begin" function.
  • Set the RST line to HIGH in the "PN5180::setup" function so that the "PN5180::reset" function works properly.

I've also found and fixed a number of minor coding errors... (see the list of changes at the end of this message):

Finally I have two outstanding issues.

  • The first issue is that in my call to setup the second PN5180 it always "hangs" in the final while loop of the "PN5180::setRF_on" function. For the moment I have dummied this out with a 100msec delay, (see code excerpt below). I'd appreciate it if you can suggest a better fix.
bool PN5180::setRF_on() {
  PN5180DEBUG(F("Set RF ON\n"));

  uint8_t cmd[2] = { PN5180_RF_ON, 0x00 };

  SPI.beginTransaction(PN5180_SPI_SETTINGS);
  transceiveCommand(cmd, 2);
  SPI.endTransaction();

//  while (0 == (TX_RFON_IRQ_STAT & getIRQStatus())); // wait for RF field to set up
  delay(100);  // Replace while loop with a straight delay because the setup of the second PN5180 reader will hang on the while loop, (not sure why?)
  clearIRQStatus(TX_RFON_IRQ_STAT);
  return true;
}
  • The second issue I'm having is that in order to get a Write operation to work with the Texas Instruments RF-HDT-DVBB "laundry" tag we use in our application, I've had to set the Request Code to 0x62, (ie. Turn ON bit 6). This was based on a note in the tag's datasheet which suggested that bit 7 needed to be ON for Write operations. It took me a while before I realised that the datasheet author counted from 1, (and not 0 like the rest of the world's engineers). If this bit is not set then the "writeNFC" function fails with an "Option not supported" error. Is there somewhere that I can find a definitive description of the Request Code flags?

List of Coding Fixes:

Line 249: PN5180.cpp
/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180.cpp:250:13: warning: comparison is always false due to limited range of data type [-Wtype-limits]
if (len > 260) {
^

bool PN5180::sendData(uint8_t *data, size_t len, uint8_t validBits)

Line 432: PN5180ISO15693.cpp
ISO15693ErrorCode PN5180ISO15693::issueISO15693Command(uint8_t *cmd, size_t cmdLen, uint8_t **resultPtr)

Line 115: PN5180ISO15693.cpp
/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.cpp:115:41: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<sizeof(readSingleBlock); i++) {
^

for (int i=0; i<(int)sizeof(readSingleBlock); i++) {

Line 278: PN5180ISO15693.cpp
/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.cpp:278:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0; i<sizeof(sysInfo); i++) {
^

for (int i=0; i<(int)sizeof(sysInfo); i++) {

Line 486: PN5180ISO15693.cpp
_/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.h:60:30: error: initializing argument 1 of 'const __FlashStringHelper* PN5180ISO15693::strerror(ISO15693ErrorCode)' [-fpermissive]
const _FlashStringHelper *strerror(ISO15693ErrorCode errno);
^

PN5180DEBUG(strerror((ISO15693ErrorCode)errorCode));

@RatGit
Copy link
Author

RatGit commented Apr 12, 2019

ps. There were also some unused variable warnings...

/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.cpp:308:13: warning: unused variable 'dsfid' [-Wunused-variable]
uint8_t dsfid = *p++;
^

/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.cpp:351:14: warning: unused variable 'viccMemSize' [-Wunused-variable]
uint16_t viccMemSize = (*blockSize) * (*numBlocks);
^

/root/Documents/sloeber-workspace/libraries/PN5180/1.1.0/PN5180ISO15693.cpp:366:13: warning: unused variable 'icRef' [-Wunused-variable]
uint8_t icRef = *p++;
^

@Boilevin
Copy link

Hi.
I Don't know if it can help but i have this kind of trouble when wiring a ESP32 .
The wiring description in the code ommit the +5V so on ESP32Devkit powered on USB the +5V need to be wired with Vin .

Take a look at R13 and R15 on schematics.
Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants