|
|
|
|
Debian | コードネーム | 年月 | 備考 | (参考)Ubuntuでの該当名称 |
Debian 11 | Bullseye | 2021/08/14~ | 2021/11からラズパイにリリース | Focal Fossa 20.04 LTS ? |
Debian 10 | Buster | 2019/06/20~ | 2019/06からラズパイ4対応 | Bionic 18.04 LTS |
Debian 9 | Stretch | 2017/08/16~ | 2018/03からラズパイ3B+対応 | Xenial 16.04 LTS |
Debian 8 | Jessie | 2015~ | 2016/02からラズパイ3対応 | Trusty 14.04 LTS |
Debian 7 | Wheezy | 2013~2016 | ||
Debian 6.0 | Squeeze | 2011~2014 | ||
Debian GNU/Linux 5.0 | Lenny | 2009~2012 |
Hobbypower PN532 NFC RFID V2.0リーダー ライター シールド ブレーク アウト モジュール互換性あるArduino開発ボード 評価ボード Reader Writer Shield Breakout Module Compatible Arduino ASIN: B00HY847G4 ※見た感じ大丈夫そう |
ディアイワイモール (DIYmall) PN532 NFC RFID module V3 キットNFC for Android Phone ASIN: B017OPV3RC ※商品写真を見る限り ELECHOUSEの本物っぽい(基板表面のフォントがゴシック体、基板裏面の ELECHOUSEのフォントが斜体になっている) |
[泓源電子] PN532 NFCモジュール13.56MHz Arduino PN532 On-board Antenna NFC / RFID Module ASIN: B01KWUV87Q ※ 商品写真を見る限り Aタイプは itead.comの本物。Bタイプは ELECHOUSEの本物っぽい |
PN532 NFC RFID読み込み 書き込みモジュール Arduino ASIN: B014OOKOC6 |
[UMKTOKYO] PN532 NFCモジュール13.56MHz Arduino PN532 On-board Antenna NFC / RFID Module ASIN: B01E6K32JU |
$ sudo apt-get install i2c-tools $ sudo i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- 24 -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- 0x24に存在するのを確認する
# I2C機能を有効に設定 $ sudo raspi-config $ sudo reboot # OSの状態を最新にアップデート $ sudo apt-get update $ sudo apt-get -y upgrade $ sudo apt-get -y dist-upgrade # 必要なパッケージをインストール # 後述の configureで configure: error: The libusb headers are missingエラーが発生する $ sudo apt-get -y install libusb-dev ● nfc-tools / libnfcライブラリ $ cd $ wget http://dl.bintray.com/nfc-tools/sources/libnfc-1.7.1.tar.bz2 $ tar -xf libnfc-1.7.1.tar.bz2 $ cd libnfc-1.7.1 $ ./configure --prefix=/usr --sysconfdir=/etc Selected drivers: acr122_pcsc...... no acr122_usb....... yes acr122s.......... yes arygon........... yes pn53x_usb........ yes pn532_uart....... yes pn532_spi....... yes pn532_i2c........ yes $ make ● libnfc用設定ファイルの設置 $ sudo mkdir /etc/nfc/ $ sudo nano /etc/nfc/libnfc.conf --- ↓ここから --- # https://raw.githubusercontent.com/nfc-tools/libnfc/master/libnfc.conf.sample # http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_3_i2c_nfc_rfid_pn532/ # Allow device auto-detection (default: true) # Note: if this auto-detection is disabled, user has to set manually a device # configuration using file or environment variable #allow_autoscan = true allow_autoscan = true # Allow intrusive auto-detection (default: false) # Warning: intrusive auto-detection can seriously disturb other devices # This option is not recommended, user should prefer to add manually his device. #allow_intrusive_scan = false allow_intrusive_scan = false # Set log level (default: error) # Valid log levels are (in order of verbosity): 0 (none), 1 (error), 2 (info), 3 (debug) # Note: if you compiled with --enable-debug option, the default log level is "debug" #log_level = 1 log_level = 1 # Manually set default device (no default) # To set a default device, you must set both name and connstring for your device # Note: if autoscan is enabled, default device will be the first device available in device list. #device.name = "microBuilder.eu" #device.connstring = "pn532_uart:/dev/ttyUSB0" # http://nfc-tools.org/index.php?title=Libnfc:configuration#PN532_device_on_R-Pi_connected_using_I2C device.name = "Itead_PN532" device.connstring = "pn532_i2c:/dev/i2c-1" --- ↑ここまで --- ● 面倒な場合は下記でサクッと設定ファイルを配置 $ wget https://raw.githubusercontent.com/FREEWING-JP/libnfc/libnfc_raspberry_pi_i2c/libnfc_raspberry_pi_i2c/libnfc.conf.i2c $ sudo mkdir /etc/nfc/ $ sudo cp libnfc.conf.i2c /etc/nfc/libnfc.conf ● libnfcが動くかを確認する $ ./utils/nfc-scan-device -v /home/pi/libnfc-1.7.1/utils/.libs/lt-nfc-scan-device uses libnfc 1.7.1 1 NFC device(s) found: - pn532_i2c:/dev/i2c-1: pn532_i2c:/dev/i2c-1 chip: PN532 v1.6 initator mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), ISO/IEC 14443-4B (106 kbps), Innovision Jewel (106 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps) target mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps) ● libnfcが動くかを確認する $ ./examples/nfc-poll -v /home/pi/libnfc-1.7.1/examples/.libs/lt-nfc-poll uses libnfc 1.7.1 ● OKICAを読み込んだ場合(沖縄版スイカ) /home/pi/libnfc-1.7.1/examples/.libs/lt-nfc-poll uses libnfc 1.7.1 NFC reader: pn532_i2c:/dev/i2c-1 opened NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations) FeliCa (212 kbps) target: ID (NFCID2): 01 14 xx xx xx xx xx xx Parameter (PAD): 01 20 xx xx xx xx xx xx System Code (SC): 2d 15 nfc_initiator_target_is_present: Target Released Waiting for card removing...done. ※ OKICAカードは反応が有りますが、Suicaや Edy、au WALLET等の FeliCaカードは反応が有りませんでした(読み込みしない)。また、OKICAも読み込み成功したり失敗したりの症状が有り安定して動きません。そもそも前述の様に Suicaを読まないのも変。原因不明。 ● raspi-configで I2C機能が有効になっていない場合 Cannot open I2C bus: No such file or directory lt-nfc-poll: ERROR: Unable to open NFC device. ● 動作確認ができたらインストール $ sudo make install
HiLetgo USB TO TTLシリアル変換モジュール コンバータモジュール CP2102 STC [並行輸入品] ASIN: B010Q176F4 |
【ノーブランド品】USB→TTL コンバーターモジュール アダプター モジュール CP2102 シリアル変換 ASIN: B008RF73CS |
Rasbee オリジナル CP-2102 シリアル変換モジュール USB2.0 - TTLモジュール 6ピン CP2102 STC PRGMR 1個 [並行輸入品] ASIN: B01FVT3QQY |
$ lsusb Bus 001 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light ← USBシリアル変換 Bus 001 Device 004: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub ● 下記でサクッとUART用の設定ファイルを配置 $ wget https://raw.githubusercontent.com/FREEWING-JP/libnfc/libnfc_raspberry_pi_i2c/libnfc_raspberry_pi_i2c/libnfc.conf.uart $ sudo mkdir /etc/nfc/ $ sudo cp libnfc.conf.uart /etc/nfc/libnfc.conf $ nfc-list nfc-list uses libnfc 1.7.1 NFC device: pn532_uart:/dev/ttyUSB0 opened $ pn53x-diagnose pn53x-diagnose uses libnfc 1.7.1 NFC device [pn532_uart:/dev/ttyUSB0] opened. Communication line test: OK ROM test: OK RAM test: OK $ nfc-poll nfc-poll uses libnfc 1.7.1 NFC reader: pn532_uart:/dev/ttyUSB0 opened 5 NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations) FeliCa (424 kbps) target: ID (NFCID2): 01 02 03 04 05 06 07 08 Parameter (PAD): 01 22 33 44 55 66 77 88 System Code (SC): 2d 15 nfc_initiator_target_is_present: Target Released Waiting for card removing...done. $ nfc-poll nfc-poll uses libnfc 1.7.1 NFC reader: pn532_uart:/dev/ttyUSB0 opened 5 NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations) ISO/IEC 14443A (106 kbps) target: ATQA (SENS_RES): 00 04 UID (NFCID1): b1 xx xx xx SAK (SEL_RES): 08 nfc_initiator_target_is_present: Target Released Waiting for card removing...done.
pi@raspberrypi:~ $ LIBNFC_LOG_LEVEL=3 nfc-read-forum-tag3 -o - debug libnfc.config key: [allow_autoscan], value: [true] debug libnfc.config key: [allow_intrusive_scan], value: [false] debug libnfc.config key: [log_level], value: [1] debug libnfc.config key: [device.name], value: [Itead_PN532] debug libnfc.config key: [device.connstring], value: [pn532_uart:/dev/ttyUSB0] debug libnfc.config Unable to open directory: /etc/nfc/devices.d debug libnfc.general log_level is set to 3 debug libnfc.general allow_autoscan is set to true debug libnfc.general allow_intrusive_scan is set to false debug libnfc.general 1 device(s) defined by user debug libnfc.general #0 name: "Itead_PN532", connstring: "pn532_uart:/dev/ttyUSB0" debug libnfc.driver.pn532_uart Attempt to open: /dev/ttyUSB0 at 115200 bauds. debug libnfc.bus.uart Serial port speed requested to be set to 115200 bauds. debug libnfc.chip.pn53x Diagnose debug libnfc.chip.pn53x Timeout value: 500 debug libnfc.bus.uart TX: 55 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00 debug libnfc.chip.pn53x SAMConfiguration debug libnfc.chip.pn53x Timeout value: 1000 debug libnfc.bus.uart TX: 00 00 ff 03 fd d4 14 01 17 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 15 debug libnfc.bus.uart RX: 16 00 debug libnfc.bus.uart TX: 00 00 ff 09 f7 d4 00 00 6c 69 62 6e 66 63 be 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 09 f7 debug libnfc.bus.uart RX: d5 01 debug libnfc.bus.uart RX: 00 6c 69 62 6e 66 63 debug libnfc.bus.uart RX: bc 00 debug libnfc.chip.pn53x GetFirmwareVersion debug libnfc.bus.uart TX: 00 00 ff 02 fe d4 02 2a 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 06 fa debug libnfc.bus.uart RX: d5 03 debug libnfc.bus.uart RX: 32 01 06 07 debug libnfc.bus.uart RX: e8 00 debug libnfc.chip.pn53x SetParameters debug libnfc.bus.uart TX: 00 00 ff 03 fd d4 12 14 06 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 13 debug libnfc.bus.uart RX: 18 00 debug libnfc.general "pn532_uart:/dev/ttyUSB0" (pn532_uart:/dev/ttyUSB0) has been claimed. NFC device: pn532_uart:/dev/ttyUSB0 opened debug libnfc.chip.pn53x ReadRegister debug libnfc.bus.uart TX: 00 00 ff 0c f4 d4 06 63 02 63 03 63 0d 63 38 63 3d b0 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 07 f9 debug libnfc.bus.uart RX: d5 07 debug libnfc.bus.uart RX: 00 00 00 00 00 debug libnfc.bus.uart RX: 24 00 debug libnfc.chip.pn53x PN53X_REG_CIU_TxMode (Defines the transmission data rate and framing during transmission) debug libnfc.chip.pn53x PN53X_REG_CIU_RxMode (Defines the transmission data rate and framing during receiving) debug libnfc.chip.pn53x WriteRegister debug libnfc.bus.uart TX: 00 00 ff 08 f8 d4 08 63 02 80 63 03 80 59 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 09 debug libnfc.bus.uart RX: 22 00 debug libnfc.chip.pn53x RFConfiguration debug libnfc.bus.uart TX: 00 00 ff 04 fc d4 32 01 00 f9 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 33 debug libnfc.bus.uart RX: f8 00 debug libnfc.chip.pn53x RFConfiguration debug libnfc.bus.uart TX: 00 00 ff 04 fc d4 32 01 01 f8 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 33 debug libnfc.bus.uart RX: f8 00 debug libnfc.chip.pn53x RFConfiguration debug libnfc.bus.uart TX: 00 00 ff 06 fa d4 32 05 ff ff ff f8 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 33 debug libnfc.bus.uart RX: f8 00 Place your NFC Forum Tag Type 3 in the field... debug libnfc.chip.pn53x ReadRegister debug libnfc.bus.uart TX: 00 00 ff 0e f2 d4 06 63 02 63 03 63 05 63 38 63 3c 63 3d 19 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 08 f8 debug libnfc.bus.uart RX: d5 07 debug libnfc.bus.uart RX: 80 80 00 00 00 00 debug libnfc.bus.uart RX: 24 00 debug libnfc.chip.pn53x PN53X_REG_CIU_TxAuto (Controls the settings of the antenna driver) debug libnfc.chip.pn53x PN53X_REG_CIU_Control (Contains miscellaneous control bits) debug libnfc.chip.pn53x WriteRegister debug libnfc.bus.uart TX: 00 00 ff 08 f8 d4 08 63 05 40 63 3c 10 cd 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 09 debug libnfc.bus.uart RX: 22 00 debug libnfc.chip.pn53x InListPassiveTarget debug libnfc.chip.pn53x No timeout debug libnfc.bus.uart TX: 00 00 ff 09 f7 d4 4a 01 01 00 ff ff 01 00 e1 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed ~~ ここで止まったままになる ~~ ~~ カードをかざしても反応が無い ~~ [Ctrl+C]で中断 ^Cdebug libnfc.bus.uart Abort! debug libnfc.bus.uart TX: 00 00 ff 00 ff 00 nfc_initiator_select_passive_target: Operation Aborted debug libnfc.chip.pn53x InRelease debug libnfc.bus.uart TX: 00 00 ff 03 fd d4 52 00 da 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 03 fd debug libnfc.bus.uart RX: d5 53 debug libnfc.bus.uart RX: 00 debug libnfc.bus.uart RX: d8 00 debug libnfc.chip.pn53x RFConfiguration debug libnfc.bus.uart TX: 00 00 ff 04 fc d4 32 01 00 f9 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 02 fe debug libnfc.bus.uart RX: d5 33 debug libnfc.bus.uart RX: f8 00 debug libnfc.chip.pn53x PowerDown debug libnfc.bus.uart TX: 00 00 ff 03 fd d4 16 f0 26 00 debug libnfc.bus.uart RX: 00 00 ff 00 ff 00 debug libnfc.chip.pn53x PN53x ACKed debug libnfc.bus.uart RX: 00 00 ff 03 fd debug libnfc.bus.uart RX: d5 17 debug libnfc.bus.uart RX: 00 debug libnfc.bus.uart RX: 14 00