> For the complete documentation index, see [llms.txt](https://amobile-solutions.gitbook.io/yocto-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://amobile-solutions.gitbook.io/yocto-developer-guide/test-and-use-the-interface/nfc/nfc-iot-800n-g420.md).

# NFC - IOT-800N-G420

## Overview

|              |                       |
| ------------ | --------------------- |
| Controller   | Renesas PTX130R       |
| Interface    | SPI, `/dev/spidev1.0` |
| IRQ          | GPIO85                |
| Chip enable  | GPIO3 (`NFC_SEN`)     |
| Power enable | GPIO4 (`NFC_PWR_EN`)  |

The controller is configured for SPI by the SIF1/SIF2 straps on the board.

{% hint style="warning" %}
Power and chip enable are two separate signals on carrier revision R02. GPIO4 enables an SGM66055 boost converter producing the chip's supply, and GPIO3 drives the PTX130R's own SEN pin. Power has to come up first.

On R0.1 a single GPIO did both. Without the supply the chip is unpowered and SPI reads back `0xFF` for every byte, which looks like a bus fault rather than a missing rail.
{% endhint %}

The 5 V rail is held by a fixed regulator in the device tree, so nothing in userspace has to manage it.

## Presence check

```
nfc-selftest.sh
```

```
NFC PASS (PTX130R chip id 0x21)
```

The script asserts SEN, sends a chip ID query over SPI and checks that the fourth byte returns `0x21`. It depends on nothing from the PTX SDK.

If it reports all `FF`, the chip has no power:

```
gpioinfo | grep -i nfc
grep nfc_5v /sys/kernel/debug/regulator/regulator_summary
```

## Configuration files

The PTX stack reads these at startup from `/etc/ptx/`:

| File                 | Contents                              |
| -------------------- | ------------------------------------- |
| `NSC_RF_CONFIG.dat`  | RF parameters, tuned for this antenna |
| `NSC_SYS_CONFIG.dat` | System configuration                  |
| `libnfc-ptx.conf`    | Stack configuration                   |

{% hint style="danger" %}
`NSC_RF_CONFIG.dat` is the result of tuning for one specific antenna. A different antenna, board or enclosure requires retuning and a new file. Using the wrong one degrades read range and stability, and reports no error at all — cards simply stop being read at distance.
{% endhint %}

## Detecting a card

The SDK supplied for this board provides `NCIRDExample`, a POS-DTE conformance tool. Its `WUPA` command sends an ISO14443-3A wake-up, and the status distinguishes a card in the field from an empty one:

```
NCIRDExample
```

```
Enter command > WUPA
TX: PROPR_POS_DTE_CMD (05 )
RX: PROPR_POS_DTE_RSP (STATUS_OK; )
status: 0000
```

| Status | Meaning                        |
| ------ | ------------------------------ |
| `0000` | A tag answered with ATQA       |
| `2a32` | No answer; no tag in the field |

{% hint style="info" %}
POS-DTE is a conformance test tool. It exercises the RF front end and reports whether a command was accepted, but does not read a card's UID or contents. Its `POLLING` command returns success whether or not a card is present, so `WUPA` is the one to use for presence detection.
{% endhint %}

## Other DTE commands

```
Enter command > HELP
```

| Command    | Function                                 |
| ---------- | ---------------------------------------- |
| `CARRIER`  | Emit an unmodulated carrier              |
| `POLLING`  | Poll for Type A and Type B               |
| `POLLINGA` | Poll for Type A only                     |
| `WUPA`     | Send an ISO14443-3A wake-up              |
| `WUPB`     | Send an ISO14443-3B wake-up              |
| `RATS`     | Collision detection, activation and RATS |
| `RESET`    | Reset the operating field                |
| `POWEROFF` | Power off the operating field            |

## Initialisation sequence

Running `NCIRDExample` shows the full NCI startup, which is a useful health check in its own right:

```
Allocating NCI-Reader Stack-Component ...... OK
Initializing NCI-Reader Stack-Component .... OK
TX: CORE_RESET_CMD
RX: CORE_RESET_RSP (STATUS_OK)
RX: CORE_RESET_NTF
Manufacturer.........: Renesas Electronics Corporation
...
TX: CORE_INIT_CMD
RX: CORE_INIT_RSP (STATUS_OK)
Supported RF-Interfaces: NCI_RF_INTF_FRAME, NCI_RF_INTF_ISODEP, NCI_RF_INTF_NFCDEP
```

Reaching `CORE_INIT_RSP (STATUS_OK)` proves SPI communication, the chip's firmware and the RF configuration files are all in place.
