{"id":296,"date":"2021-02-09T23:48:42","date_gmt":"2021-02-09T14:48:42","guid":{"rendered":"https:\/\/www.drassal.net\/wp\/?p=296"},"modified":"2021-02-09T23:56:12","modified_gmt":"2021-02-09T14:56:12","slug":"reading-felica-rfid-with-a-rc-s620s-and-arduino","status":"publish","type":"post","link":"https:\/\/www.drassal.net\/wp\/reading-felica-rfid-with-a-rc-s620s-and-arduino\/","title":{"rendered":"Reading FeliCa RFID with a RC-S620S and Arduino"},"content":{"rendered":"<p><a href=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592.jpg\" target=\"_blank\" rel=\"attachment wp-att-299\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-299\" src=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592.jpg\" alt=\"FeliCa reader project\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592.jpg 4032w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592-300x225.jpg 300w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592-768x576.jpg 768w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592-1024x768.jpg 1024w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6592-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>After some more playing around with RFID tags and trying to read some FeliCa tags with the Proxmark3 it was obvious I needed a reader designed for FeliCa. \u00a0FeliCa was designed by SONY and has a very long history of usage starting in the 1990&#8217;s and beginning wide use in 2001 with the SUICA prepaid rail card. \u00a0It is similar to a\u00a0ISO\/IEC 14443, and is closer to a\u00a0ISO\/IEC 18092 (Near Field Communication, NFC TYPE-F) in its communications but its specification actually follows specification\u00a0JIS: X6319-4.<\/p>\n<p>The card offers very high level encryption and security, I have not seen a single instance of it being hacked even after all these years (yet).<\/p>\n<p>To read the card and get the card id, called the IDm, I found a RC-S620S FeliCa reader at the local shop and searched around to see if anyone had attempted to connect it up to an Arduino platform. \u00a0Not suppressing I found\u00a0some information on this site below with some sample Arduino code.<\/p>\n<p><a href=\"https:\/\/deviceplus.jp\/hobby\/entry_f02\/\" target=\"_blank\">https:\/\/deviceplus.jp\/hobby\/entry_f02\/<\/a><\/p>\n<p>With this information I used the Arduino platform to successfully retrieve the IDm from various FeliCa cards in my possession. \u00a0After this, I found out that it is not that difficult to retrieve the current balance of the electronic money on the card as well after running across the following below site. \u00a0FeliCa is very commonly used in Japan and this can retrieve the unique 8 byte card id (IDm)\u00a0and balance information for Suica, Icoca, PiTaPa, nanao, edy, and others.<\/p>\n<p><a href=\"https:\/\/www.orsx.net\/archives\/3835\" target=\"_blank\">https:\/\/www.orsx.net\/archives\/3835<\/a><\/p>\n<p>I then proceeded to create a reader with an OLED display to display the IDm of the card along with the remaining electronic money balance. \u00a0This uses an Arduino Feather M0 basic along with a 128&#215;64 OLED display to show the results. \u00a0Surprisingly, SONY released an Arduino library for the RC-S620S, which is still up on their website for download, but needs a few fixes since it is from so many years back (2000).<\/p>\n<p><a href=\"http:\/\/blog.felicalauncher.com\/sdk_for_air\/?page_id=2699\" target=\"_blank\">http:\/\/blog.felicalauncher.com\/sdk_for_air\/?page_id=2699<br \/>\n<\/a><br \/>\nDownload the above library and place it in the Arduino &#8220;libraries&#8221; folder. \u00a0In the file &#8220;RCS620S.cpp&#8221; the following changes need to be made.<\/p>\n<table border=\"0\" bgcolor=\"ffffff\">\n<tbody>\n<tr>\n<th>Line<\/th>\n<th>Search for<\/th>\n<th>Replace with<\/th>\n<\/tr>\n<tr>\n<td>10<\/td>\n<td>#include \u201cWprogram.h\u201d<\/td>\n<td>#include \u201cArduino.h\u201d<\/td>\n<\/tr>\n<tr>\n<td>312<\/td>\n<td>Serial.write(data, len);<\/td>\n<td>Serial1.write(data, len);<\/td>\n<\/tr>\n<tr>\n<td>327<\/td>\n<td>if (Serial.available() &gt; 0) {<\/td>\n<td>if (Serial1.available() &gt; 0) {<\/td>\n<\/tr>\n<tr>\n<td>328<\/td>\n<td>data[nread] = Serial.read();<\/td>\n<td>data[nread] = Serial1.read();<\/td>\n<\/tr>\n<tr>\n<td>338<\/td>\n<td>Serial.flush();<\/td>\n<td>Serial1.flush();<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The following hardware items were used in this project:<\/p>\n<table border=\"0\" bgcolor=\"ffffff\">\n<tbody>\n<tr>\n<td colspan=\"2\">Adafruit Feather M0 Basic Proto &#8211; ATSAMD21 Cortex M0<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td><a href=\"https:\/\/www.adafruit.com\/product\/2772\" target=\"_blank\">https:\/\/www.adafruit.com\/product\/2772<\/a><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">Adafruit FeatherWing OLED &#8211; 128&#215;64 OLED Add-on For Feather<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td><a href=\"https:\/\/www.adafruit.com\/product\/4650\" target=\"_blank\">https:\/\/www.adafruit.com\/product\/4650<\/a><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">FeatherWing Tripler Mini Kit &#8211; Prototyping Add-on For Feathers<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td><a href=\"https:\/\/www.adafruit.com\/product\/3417\" target=\"_blank\">https:\/\/www.adafruit.com\/product\/3417<\/a><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">NFC FeliCa Reader\/Writer Module RC-S620\/S<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td><a href=\"https:\/\/international.switch-science.com\/catalog\/353\/\" target=\"_blank\">https:\/\/international.switch-science.com\/catalog\/353\/<\/a><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">FeliCa RC-S620\/S and FeliCa Link RC-S730 pitch converter board set (with flat cable)<\/td>\n<\/tr>\n<tr>\n<td>+<\/td>\n<td><a href=\"https:\/\/international.switch-science.com\/catalog\/1029\/\" target=\"_blank\">https:\/\/international.switch-science.com\/catalog\/1029\/<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Here is the pinout of the RC-S602S. \u00a0It can work on either 3.3V or 5.0V. \u00a0Connect to the &#8220;uart1&#8221; of the Arduino device being used. \u00a0In the case of the Adafruit Feather m0 Basic this is D0 (UART1 RX) and D1 (UART1 TD). \u00a0There are two grounds, connect them both to ground. \u00a0The RC-S620S can be powered by 5.0v or 3.3v. \u00a0An Arduino Uno would work, but it has only one hardware UART, the softserial won&#8217;t be able to keep up with the 115200 BAUD of the RC-S620S. \u00a0I believe the limit for the softserial is around 9600 or 19200.<\/p>\n<p>Connect the flat cable as shown here in the picture.<\/p>\n<p><a href=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589.jpg\" target=\"_blank\" rel=\"attachment wp-att-301\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-301\" src=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589.jpg\" alt=\"RC-S620S flat cable\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589.jpg 4032w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589-300x225.jpg 300w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589-768x576.jpg 768w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589-1024x768.jpg 1024w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6589-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591.jpg\" rel=\"attachment wp-att-302\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-302\" src=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591.jpg\" alt=\"RC-S620S\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591.jpg 4032w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591-300x225.jpg 300w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591-768x576.jpg 768w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591-1024x768.jpg 1024w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6591-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590.jpg\" target=\"_blank\" rel=\"attachment wp-att-300\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-300\" src=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590.jpg\" alt=\"RC-S620S pinout\" width=\"600\" height=\"450\" srcset=\"https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590.jpg 4032w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590-300x225.jpg 300w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590-768x576.jpg 768w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590-1024x768.jpg 1024w, https:\/\/www.drassal.net\/wp\/wp-content\/uploads\/2021\/02\/IMG_6590-1200x900.jpg 1200w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<table>\n<tbody>\n<tr>\n<th>pin<\/th>\n<th>color<\/th>\n<th>description<\/th>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td>red<\/td>\n<td>VCC (5v or 3.3v)<\/td>\n<\/tr>\n<tr>\n<td>2<\/td>\n<td>green<\/td>\n<td>RXD<\/td>\n<\/tr>\n<tr>\n<td>3<\/td>\n<td>white<\/td>\n<td>TXD<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>black<\/td>\n<td>GND<\/td>\n<\/tr>\n<tr>\n<td>5<\/td>\n<td>n\/c<\/td>\n<td>do not connect, reserved<\/td>\n<\/tr>\n<tr>\n<td>6<\/td>\n<td>black<\/td>\n<td>GND<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A version with the OLED display functions is in the below ZIP file, it is rather big to copy paste here. \u00a0Credit for the parts that I copy pasted is these two sources below.<\/p>\n<p><a href=\"https:\/\/deviceplus.jp\/hobby\/entry_f02\/\" target=\"_blank\">https:\/\/deviceplus.jp\/hobby\/entry_f02\/<\/a><br \/>\n<a href=\"https:\/\/www.orsx.net\/archives\/3835\" target=\"_blank\">https:\/\/www.orsx.net\/archives\/3835<\/a><\/p>\n<p><a href=\"https:\/\/www.drassal.net\/filestore\/m0_felica_oled_20210209.zip\" target=\"_blank\">https:\/\/www.drassal.net\/filestore\/m0_felica_oled_20210209.zip<\/a><\/p>\n<p>The following code is a very simple serial only version that can be pasted. \u00a0A zip fie is also available to download.<\/p>\n<p><a href=\"https:\/\/www.drassal.net\/filestore\/m0_felica_uart_20210209.zip\" target=\"_blank\">https:\/\/www.drassal.net\/filestore\/m0_felica_uart_20210209.zip<\/a><\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &lt;RCS620S.h&gt;\r\n\r\n#define COMMAND_TIMEOUT               400\r\n#define POLLING_INTERVAL              500\r\n#define RCS620S_MAX_CARD_RESPONSE_LEN 30\r\n\r\n\/\/ FeliCa Service\/System Code\r\n#define CYBERNE_SYSTEM_CODE           0x0003\r\n#define COMMON_SYSTEM_CODE            0xFE00\r\n#define PASSNET_SERVICE_CODE          0x090F\r\n#define EDY_SERVICE_CODE              0x170F\r\n#define NANACO_SERVICE_CODE           0x564F\r\n#define WAON_SERVICE_CODE             0x680B\r\n\r\nRCS620S rcs620s;\r\n\r\n\/\/ UNO\r\n#define SERIAL_DEBUG Serial\r\n\/\/ Due\r\n\/\/ #define SERIAL_DEBUG SerialUSB\r\n\r\nvoid setup() {\r\n  int ret;\r\n  while (!Serial &amp;&amp; millis() &lt; 10000);\r\n  Serial.begin(115200);\r\n  Serial.println(&quot;Serial init done!&quot;);\r\n\r\n  \/\/ RC-S620S\u306e\u521d\u671f\u5316\r\n  Serial1.begin(115200);\r\n  Serial.println(&quot;Serial1 init done!&quot;);\r\n  ret = rcs620s.initDevice();\r\n  while (!ret) {}\r\n  rcs620s.timeout = COMMAND_TIMEOUT;\r\n  Serial.println(&quot;RC-S620S init ok&quot;);\r\n}\r\n\r\nvoid polling(void) {\r\n  int ret;\r\n  char temp&#x5B;3];\r\n  char cardid&#x5B;17];\r\n\r\n  \/\/ FeliCa\u306e\u30bf\u30c3\u30c1\u72b6\u614b\u3092\u5f97\u308b\r\n  ret = rcs620s.polling();\r\n\r\n  \/\/ FeliCa\u304c\u30bf\u30c3\u30c1\u3055\u308c\u305f\u5834\u5408\r\n  if(ret) {\r\n    \/\/ IDm\u3092\u53d6\u5f97\u3059\u308b\r\n    for(int i = 0; i &lt; 8; i++){\r\n      sprintf(temp, &quot;%02X&quot;, rcs620s.idm&#x5B;i]);\r\n      cardid&#x5B;i * 2] = temp&#x5B;0];\r\n      cardid&#x5B;(i * 2) + 1] = temp&#x5B;1];\r\n    }\r\n    cardid&#x5B;16] = 0;\r\n\r\n    printId(cardid);\r\n  }\r\n  \r\n  rcs620s.rfOff();\r\n}\r\n\r\nvoid polling_balance(void) {\r\n  char temp&#x5B;3];\r\n  char cardid&#x5B;17];\r\n  uint32_t balance;\r\n  uint8_t buf&#x5B;RCS620S_MAX_CARD_RESPONSE_LEN];\r\n   \r\n  rcs620s.timeout = COMMAND_TIMEOUT;\r\n   \r\n  \/\/ \u30b5\u30a4\u30d0\u30cd\u9818\u57df\r\n  if(rcs620s.polling(CYBERNE_SYSTEM_CODE)){\r\n    \/\/ Suica PASMO\r\n    if(requestService(PASSNET_SERVICE_CODE)){\r\n      if(readEncryption(PASSNET_SERVICE_CODE, 0, buf)){\r\n        \/\/ Little Endian\u3067\u5165\u3063\u3066\u3044\u308bPASSNET\u306e\u6b8b\u9ad8\u3092\u53d6\u308a\u51fa\u3059\r\n        balance = buf&#x5B;23];                  \/\/ 11 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;22]; \/\/ 10 byte\u76ee\r\n\r\n        \/\/ IDm\u3092\u53d6\u5f97\u3059\u308b\r\n        for(int i = 0; i &lt; 8; i++){\r\n          sprintf(temp, &quot;%02X&quot;, rcs620s.idm&#x5B;i]);\r\n          cardid&#x5B;i * 2] = temp&#x5B;0];\r\n          cardid&#x5B;(i * 2) + 1] = temp&#x5B;1];\r\n        }\r\n        cardid&#x5B;16] = 0;\r\n\r\n        \/\/ \u6b8b\u9ad8\u8868\u793a\r\n        printBalance(cardid, &quot;PASSNET&quot;, &amp;balance);\r\n      }\r\n    }\r\n  }\r\n   \r\n  \/\/ \u5171\u901a\u9818\u57df\r\n  else if(rcs620s.polling(COMMON_SYSTEM_CODE)){\r\n    \/\/ Edy\r\n    if(requestService(EDY_SERVICE_CODE)){\r\n      if(readEncryption(EDY_SERVICE_CODE, 0, buf)){\r\n        \/\/ Big Endian\u3067\u5165\u3063\u3066\u3044\u308bEdy\u306e\u6b8b\u9ad8\u3092\u53d6\u308a\u51fa\u3059\r\n        balance = buf&#x5B;26];                  \/\/ 14 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;27]; \/\/ 15 byte\u76ee\r\n\r\n        \/\/ IDm\u3092\u53d6\u5f97\u3059\u308b\r\n        for(int i = 0; i &lt; 8; i++){\r\n          sprintf(temp, &quot;%02X&quot;, rcs620s.idm&#x5B;i]);\r\n          cardid&#x5B;i * 2] = temp&#x5B;0];\r\n          cardid&#x5B;(i * 2) + 1] = temp&#x5B;1];\r\n        }\r\n        cardid&#x5B;16] = 0;\r\n\r\n        \/\/ \u6b8b\u9ad8\u8868\u793a\r\n        printBalance(cardid, &quot;Edy&quot;, &amp;balance);\r\n      }\r\n    }\r\n     \r\n    \/\/ nanaco\r\n    else if(requestService(NANACO_SERVICE_CODE)){\r\n      if(readEncryption(NANACO_SERVICE_CODE, 0, buf)){\r\n        \/\/ Big Endian\u3067\u5165\u3063\u3066\u3044\u308bNanaco\u306e\u6b8b\u9ad8\u3092\u53d6\u308a\u51fa\u3059\r\n        balance = buf&#x5B;17];                  \/\/ 5 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;18]; \/\/ 6 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;19]; \/\/ 7 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;20]; \/\/ 8 byte\u76ee\r\n\r\n        \/\/ IDm\u3092\u53d6\u5f97\u3059\u308b\r\n        for(int i = 0; i &lt; 8; i++){\r\n          sprintf(temp, &quot;%02X&quot;, rcs620s.idm&#x5B;i]);\r\n          cardid&#x5B;i * 2] = temp&#x5B;0];\r\n          cardid&#x5B;(i * 2) + 1] = temp&#x5B;1];\r\n        }\r\n        cardid&#x5B;16] = 0;\r\n        \r\n        \/\/ \u6b8b\u9ad8\u8868\u793a\r\n        printBalance(cardid, &quot;nanaco&quot;, &amp;balance);\r\n      }\r\n    }\r\n     \r\n    \/\/ waon\r\n    else if(requestService(WAON_SERVICE_CODE)){\r\n      if(readEncryption(WAON_SERVICE_CODE, 1, buf)){\r\n        \/\/ Big Endian\u3067\u5165\u3063\u3066\u3044\u308bWaon\u306e\u6b8b\u9ad8\u3092\u53d6\u308a\u51fa\u3059\r\n        balance = buf&#x5B;17];                  \/\/ 21 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;18]; \/\/ 22 byte\u76ee\r\n        balance = (balance &lt;&lt; 8) + buf&#x5B;19]; \/\/ 23 byte\u76ee balance = balance &amp; 0x7FFFE0; \/\/ \u6b8b\u9ad818bit\u5206\u306e\u307f\u8ad6\u7406\u7a4d\u3067\u53d6\u308a\u51fa\u3059 balance = balance &gt;&gt; 5;             \/\/ 5bit\u5206\u30d3\u30c3\u30c8\u30b7\u30d5\u30c8\r\n\r\n        \/\/ IDm\u3092\u53d6\u5f97\u3059\u308b\r\n        for(int i = 0; i &lt; 8; i++){ sprintf(temp, &quot;%02X&quot;, rcs620s.idm&#x5B;i]); cardid&#x5B;i * 2] = temp&#x5B;0]; cardid&#x5B;(i * 2) + 1] = temp&#x5B;1]; } cardid&#x5B;16] = 0; \/\/ \u6b8b\u9ad8\u8868\u793a printBalance(cardid, &quot;waon&quot;, &amp;balance); } } } rcs620s.rfOff(); } \/\/ request service int requestService(uint16_t serviceCode){ int ret; uint8_t buf&#x5B;RCS620S_MAX_CARD_RESPONSE_LEN]; uint8_t responseLen = 0; buf&#x5B;0] = 0x02; memcpy(buf + 1, rcs620s.idm, 8); buf&#x5B;9] = 0x01; buf&#x5B;10] = (uint8_t)((serviceCode &gt;&gt; 0) &amp; 0xff);\r\n  buf&#x5B;11] = (uint8_t)((serviceCode &gt;&gt; 8) &amp; 0xff);\r\n \r\n  ret = rcs620s.cardCommand(buf, 12, buf, &amp;responseLen);\r\n   \r\n  if(!ret || (responseLen != 12) || (buf&#x5B;0] != 0x03) ||\r\n      (memcmp(buf + 1, rcs620s.idm, 8) != 0) || ((buf&#x5B;10] == 0xff) &amp;&amp; (buf&#x5B;11] == 0xff))) {\r\n    return 0;\r\n  }\r\n \r\n  return 1;\r\n}\r\n \r\nint readEncryption(uint16_t serviceCode, uint8_t blockNumber, uint8_t *buf){\r\n  int ret;\r\n  uint8_t responseLen = 0;\r\n   \r\n  buf&#x5B;0] = 0x06;\r\n  memcpy(buf + 1, rcs620s.idm, 8);\r\n  buf&#x5B;9] = 0x01; \/\/ \u30b5\u30fc\u30d3\u30b9\u6570\r\n  buf&#x5B;10] = (uint8_t)((serviceCode &gt;&gt; 0) &amp; 0xff);\r\n  buf&#x5B;11] = (uint8_t)((serviceCode &gt;&gt; 8) &amp; 0xff);\r\n  buf&#x5B;12] = 0x01; \/\/ \u30d6\u30ed\u30c3\u30af\u6570\r\n  buf&#x5B;13] = 0x80;\r\n  buf&#x5B;14] = blockNumber;\r\n \r\n  ret = rcs620s.cardCommand(buf, 15, buf, &amp;responseLen);\r\n \r\n  if (!ret || (responseLen != 28) || (buf&#x5B;0] != 0x07) ||\r\n      (memcmp(buf + 1, rcs620s.idm, 8) != 0)) {\r\n    return 0;\r\n  }\r\n \r\n  return 1;\r\n}\r\n\r\nvoid printId(char *card_id){\r\n  Serial.print(&quot;IDm      : &quot;);\r\n  Serial.println(card_id);\r\n  return;\r\n}\r\n\r\nvoid printBalance(char *card_id, char *service_name, uint32_t *balance){\r\n  char result&#x5B;8];\r\n  Serial.print(&quot;IDm      : &quot;);\r\n  Serial.println(card_id);\r\n\r\n  Serial.print(&quot; SERVICE : &quot;);\r\n  sprintf(result, &quot;%u&quot;, *balance);\r\n  Serial.println(service_name);\r\n  \r\n  Serial.print(&quot; BALANCE : &quot;);\r\n  Serial.println(result);\r\n  \r\n  return;\r\n}\r\n\r\nvoid loop() {\r\n  \/\/ put your main code here, to run repeatedly:\r\n  \/\/polling();\r\n  polling_balance();\r\n  delay(POLLING_INTERVAL);\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>After some more playing around with RFID tags and trying to read some FeliCa tags with the Proxmark3 it was obvious I needed a reader designed for FeliCa. \u00a0FeliCa was designed by SONY and has a very long history of usage starting in the 1990&#8217;s and beginning wide use in 2001 with the SUICA prepaid rail card. \u00a0It is similar to a\u00a0ISO\/IEC 14443, and is closer to a\u00a0ISO\/IEC 18092 (Near Field Communication, NFC TYPE-F) in its communications but its specification actually follows specification\u00a0JIS: X6319-4. The card offers very high level encryption and security, I have not seen a single instance of it being hacked even after all these years (yet). [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-rfid"],"_links":{"self":[{"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":4,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/posts\/296\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.drassal.net\/wp\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}