1
0
mirror of https://github.com/whowechina/aic_pico.git synced 2024-09-24 02:58:21 +02:00

Bandai Namco reader support

This commit is contained in:
whowechina 2024-04-24 19:13:51 +08:00
parent 2ec04f309d
commit 4a2e975580
5 changed files with 773 additions and 458 deletions

Binary file not shown.

450
README.md
View File

@ -1,220 +1,230 @@
# AIC Pico and AIC Key # AIC Pico and AIC Key
**Amusement IC Card Reader, AIME & Cardio Emulator** **AIME Reader & Bandai Namco Reader & Cardio Emulator**
[点这里可以切换到中文版](README_CN.md) [点这里可以切换到中文版](README_CN.md)
<img src="doc/main.jpg" width="80%"> <img src="doc/main.jpg" width="80%">
**Features:** **Features:**
* It's small, smallest as far as I know. * It's small, smallest as far as I know.
* Many variants * Many variants
* AIC Pico (PN532) * AIC Pico (PN532)
* AIC Pico (PN5180, no housing) * AIC Pico (PN5180, no housing)
* AIC Key PN532 * AIC Key PN532
* AIC Key PN5180 * AIC Key PN5180
* AIC Pico Lib (see notes 1 below) * AIC Pico Lib (see notes 1 below)
* Easy to make. * Easy to make.
* Sega AIME I/O and Spicetools CardIO emulation. * Sega AIME I/O, Bandai Namco I/O and Spicetools CardIO emulation.
* Command line for configurations. * Command line for configurations.
* Supported card: * Supported card:
* FeliCa (Amusement IC) * FeliCa (Amusement IC)
* ISO/IEC 14443 Type A (BanaPassport, Mifare, Amiibo, some IC tags, some ID tags, etc.) * ISO/IEC 14443 Type A (BanaPassport, Mifare, Amiibo, some IC tags, some ID tags, etc.)
* ISO/IEC 15693 (Old E-Amusement cards), only with PN5180 (see notes 2 below) * ISO/IEC 15693 (Old E-Amusement cards), only with PN5180 (see notes 2 below)
* Emulates virtual AIC from any Mifare cards. * Emulates virtual AIC from any Mifare cards.
* All source files open. * All source files open.
**Notes:** **Notes:**
1. So one can integrate "AIC Pico" into other Raspberry Pi Pico based projects. See my Chu Pico project and see how it works. 1. So one can integrate "AIC Pico" into other Raspberry Pi Pico based projects. See my Chu Pico project and see how it works.
<img src="doc/aic_pico_lib.jpg" width="25%"> <img src="doc/aic_pico_lib.jpg" width="25%">
2. PN532 supports only 14443A (Mifare) and FeliCa cards, while PN5180 also supports 15693 cards (old e-Amusement cards). 2. PN532 supports only 14443A (Mifare) and FeliCa cards, while PN5180 also supports 15693 cards (old e-Amusement cards).
## Thanks ## Thanks
Thanks to many respectful guys/companies who made their tools or materials free or open source (KiCad, OnShape, InkScape, Fritzing, Raspberry things), ChatGPT and GitHub Copilot helped a lot as well. Thanks to many respectful guys/companies who made their tools or materials free or open source (KiCad, OnShape, InkScape, Fritzing, Raspberry things), ChatGPT and GitHub Copilot helped a lot as well.
And thanks to community developers and projects that helped me a lot: CrazyRedMachine (https://github.com/CrazyRedMachine) for the Spicetools Card IO part, Sucareto's AIME Reader (https://github.com/Sucareto/Arduino-Aime-Reader) for the AIME protocol part, Bottersnike (https://gitea.tendokyu.moe/Bottersnike) for his sharing of AIME and FeliCa knowledge, .NET nanoFramework (https://github.com/nanoframework) for the PN5180 part. And thanks to community developers and projects that helped me a lot:
* CrazyRedMachine (https://github.com/CrazyRedMachine) for the Spicetools Card IO part;
## Warning * Sucareto's AIME Reader (https://github.com/Sucareto/Arduino-Aime-Reader) for the AIME protocol part;
This project: * Bottersnike (https://gitea.tendokyu.moe/Bottersnike, https://sega.bsnk.me/) for AIME and FeliCa knowledge;
* Heavily depends on 3D printing, a Bambu AMS system helps a lot. * .NET nanoFramework (https://github.com/nanoframework) for the PN5180 part;
* Requires skills to solder tiny components and wires. * Gyt4 (https://github.com/gyt4/) for Bandai Namco card reader I/O
* Bananatools (https://gitea.tendokyu.moe/Hay1tsme/bananatools) for Bandai Namco card reader I/O
## Check Out My Other Projects * chujohiroto (https://github.com/chujohiroto/Raspberry-RCS620S/blob/master/rcs620s.py), as indirect reference for the Bandai Namco card reader I/O
You can also check out my other cool projects.
## Warning
<img src="https://github.com/whowechina/popn_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_teeny/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/chu_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/mai_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/diva_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/aic_pico/raw/main/doc/main.jpg" height="100px"> This project:
* Heavily depends on 3D printing, a Bambu AMS system helps a lot.
* Popn Pico: https://github.com/whowechina/popn_pico * Requires skills to solder tiny components and wires.
* IIDX Pico: https://github.com/whowechina/iidx_pico
* IIDX Teeny: https://github.com/whowechina/iidx_teeny ## Check Out My Other Projects
* Chu Pico: https://github.com/whowechina/chu_pico You can also check out my other cool projects.
* Mai Pico: https://github.com/whowechina/mai_pico
* Diva Pico: https://github.com/whowechina/diva_pico <img src="https://github.com/whowechina/popn_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_teeny/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/chu_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/mai_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/diva_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/aic_pico/raw/main/doc/main.jpg" height="100px">
* AIC Pico: https://github.com/whowechina/aic_pico
* Popn Pico: https://github.com/whowechina/popn_pico
## **Disclaimer** ## * IIDX Pico: https://github.com/whowechina/iidx_pico
I made this project in my personal time with no financial benefit or sponsorship. I will continue to improve the project. I have done my best to ensure that everything is accurate and functional, there's always a chance that mistakes may occur. I cannot be held responsible for any loss of your time or money that may result from using this open source project. Thank you for your understanding. * IIDX Teeny: https://github.com/whowechina/iidx_teeny
* Chu Pico: https://github.com/whowechina/chu_pico
Check out my other projects at my GitHub homepage. * Mai Pico: https://github.com/whowechina/mai_pico
https://github.com/whowechina/ * Diva Pico: https://github.com/whowechina/diva_pico
* AIC Pico: https://github.com/whowechina/aic_pico
## About the License
It's CC-NC. So DIY for yourself and for your friend, don't make money from it. ## **Disclaimer** ##
I made this project in my personal time with no financial benefit or sponsorship. I will continue to improve the project. I have done my best to ensure that everything is accurate and functional, there's always a chance that mistakes may occur. I cannot be held responsible for any loss of your time or money that may result from using this open source project. Thank you for your understanding.
## Building "AIC Pico (PN532)"
Seriously, this is the easiest one among all my Pico series projects. Check out my other projects at my GitHub homepage.
### Components https://github.com/whowechina/
* 1x Rasberry Pi Pico or Pico W (clones work too).
https://www.raspberrypi.com/products/raspberry-pi-pico ## About the License
* 1x PN532 Module (the Red Square board version, cheap clones work too). It's CC-NC. So DIY for yourself and for your friend, don't make money from it.
https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* Some thin wires. ## Building "AIC Pico (PN532)"
* Thin WS2812B LED strip. Seriously, this is the easiest one among all my Pico series projects.
* 4x M2*8mm screws. ### Components
* 1x Rasberry Pi Pico or Pico W (clones work too).
### 3D Prints https://www.raspberrypi.com/products/raspberry-pi-pico
* **aic_pico_bottom.stl** * 1x PN532 Module (the Red Square board version, cheap clones work too).
The bottom part. https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* Some thin wires.
For the top part, choose one that fits your need. * Thin WS2812B LED strip.
* **aic_pico_top.stl** * 4x M2*8mm screws.
Regular top part.
* **aic_pico_top_ams.3mf** ### 3D Prints
Regular top part, multi-color printing. * **aic_pico_bottom.stl**
* **aic_pico_top_tall.stl** The bottom part.
Taller top part, so a thicker LED strip can fit.
* **aic_pico_top_tall_ams.3mf** For the top part, choose one that fits your need.
Taller top part, multi-color printing. * **aic_pico_top.stl**
Regular top part.
### Wiring * **aic_pico_top_ams.3mf**
<img src="doc/pico_pn532_wiring.png" width="70%"> Regular top part, multi-color printing.
* **aic_pico_top_tall.stl**
### Assembly Taller top part, so a thicker LED strip can fit.
I'll let these images do the talk. * **aic_pico_top_tall_ams.3mf**
Taller top part, multi-color printing.
<img src="doc/pico_assemble_1.jpg" width="40%">
<img src="doc/pico_assemble_2.jpg" width="34%"> ### Wiring
<img src="doc/pico_assemble_3.jpg" width="37%"> <img src="doc/pico_pn532_wiring.png" width="70%">
<img src="doc/pico_assemble_4.jpg" width="40%">
### Assembly
#### Notes I'll let these images do the talk.
* The firmware supports up to 64 LEDs on the WS2812B LED strip. I personally used 3 as shown in main title image. But you can have different LED number, as long as they fit within the housing.
* LED might be excessively bright even at low settings, consider covering it with some filter tape. <img src="doc/pico_assemble_1.jpg" width="40%">
* The mode switch on PN532 must be in "I2C" mode, picture below shows the correct settings. <img src="doc/pico_assemble_2.jpg" width="34%">
<img src="doc/pn532_i2c.jpg" width="40%"> <img src="doc/pico_assemble_3.jpg" width="37%">
<img src="doc/pico_assemble_4.jpg" width="40%">
## Building "AIC Pico (PN5180)"
If you opt for the PN5180 NFC module, note that the housing design is up to you. Ensure it fits your design or you can use it without a case. Be prepared to solder more wires compared to the PN532 version. #### Notes
* The firmware supports up to 64 LEDs on the WS2812B LED strip. I personally used 3 as shown in main title image. But you can have different LED number, as long as they fit within the housing.
### Wiring * LED might be excessively bright even at low settings, consider covering it with some filter tape.
<img src="doc/pico_pn5180_wiring.png" width="70%"> * The mode switch on PN532 must be in "I2C" mode, picture below shows the correct settings.
<img src="doc/pn532_i2c.jpg" width="40%">
Note: WS2812B LED Strip wiring is the same as the PN532 version.
## Building "AIC Pico (PN5180)"
## Building "AIC Key" If you opt for the PN5180 NFC module, note that the housing design is up to you. Ensure it fits your design or you can use it without a case. Be prepared to solder more wires compared to the PN532 version.
AIC Key is a variation of the AIC Pico - a keypad is integrated. Much more difficult to build than the "AIC Pico" as it has many tiny components to solder.
### Wiring
### Components <img src="doc/pico_pn5180_wiring.png" width="70%">
* 1x Rasberry Pi Pico or Pico W (clones work too).
https://www.raspberrypi.com/products/raspberry-pi-pico Note: WS2812B LED Strip wiring is the same as the PN532 version.
* For NFC modules, choose one of the following options: ## Building "AIC Key"
* 1x PN532 Module (the red square board version, cheap clones work too). AIC Key is a variation of the AIC Pico - a keypad is integrated. Much more difficult to build than the "AIC Pico" as it has many tiny components to solder.
https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 1x PN5180 Module (the blue rectangle version, cheap clones work too). PN5180 supports ISO/IEC 15693 (old e-amusement cards). ### Components
<img src="doc/pn5180.jpg" width="50%"> * 1x Rasberry Pi Pico or Pico W (clones work too).
https://www.raspberrypi.com/products/raspberry-pi-pico
* For LEDs, you also have 3 options:
* Option 1: 6x side-light WS2812B 1204 LEDs (D1 to D6) and a 10ohm 0603 resistor (R1), GREEN mark in the assemble image. * For NFC modules, choose one of the following options:
* Option 2 (avaiable only for PN532 version): 6x WS2812C-2020 LEDs (D13 to D18), BLUE mark in the assemble image. * 1x PN532 Module (the red square board version, cheap clones work too).
* Option 3: 6x regular single-color 0603 LEDs (D7 to D12) and 6x 100ohm 0603 resistors (R2 to R7), PURPLE mark in the assemble image. https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 1x PN5180 Module (the blue rectangle version, cheap clones work too). PN5180 supports ISO/IEC 15693 (old e-amusement cards).
* For switches, you still have 2 option: <img src="doc/pn5180.jpg" width="50%">
* Option 1: 12x ALPS SKRRAAE010 low-profile TACT switch.
https://www.mouser.com/ProductDetail/Alps-Alpine/SKRRAAE010?qs=m0BA540hBPeKhAe3239t1w%3D%3D * For LEDs, you also have 3 options:
* Option 2: 12x Panasonic EVQP1K05M 6mm square tactile switch. * Option 1: 6x side-light WS2812B 1204 LEDs (D1 to D6) and a 10ohm 0603 resistor (R1), GREEN mark in the assemble image.
https://www3.panasonic.biz/ac/e/dl/catalog/index.jsp?series_cd=3473&part_no=EVQP1K05M * Option 2 (avaiable only for PN532 version): 6x WS2812C-2020 LEDs (D13 to D18), BLUE mark in the assemble image.
* Option 3: 6x regular single-color 0603 LEDs (D7 to D12) and 6x 100ohm 0603 resistors (R2 to R7), PURPLE mark in the assemble image.
* 1x Right angle 2.54mm pitch header, 4P for PN532, 13P for PN5180.
<img src="doc/right_angle_header.jpg" width="20%"> * For switches, you still have 2 option:
* Option 1: 12x ALPS SKRRAAE010 low-profile TACT switch.
* 1x Stickers of numbers. You can find some customize sticker service, or you can find some existing stickers. I found this Bonito crystal 3D stickers super helpful for this project. https://www.mouser.com/ProductDetail/Alps-Alpine/SKRRAAE010?qs=m0BA540hBPeKhAe3239t1w%3D%3D
<img src="doc/bonito_stickers.png" width="50%"> * Option 2: 12x Panasonic EVQP1K05M 6mm square tactile switch.
<img src="doc/bonito_action.jpg" width="50%"> https://www3.panasonic.biz/ac/e/dl/catalog/index.jsp?series_cd=3473&part_no=EVQP1K05M
* PCB, just visit JLCPCB (https://jlcpcb.com/) and place an order there. Leave everything default, 1.6mm thickness, whatever color you like. PCB gerber files are in "Production/PCB" folder. For PN532 version, use "aic_key_pn532_v*.zip", for PN5180 version, use "aic_key_pn5180_v*.zip". * 1x Right angle 2.54mm pitch header, 4P for PN532, 13P for PN5180.
<img src="doc/pcbs.jpg" width="60%"> <img src="doc/right_angle_header.jpg" width="20%">
### 3D Prints * 1x Stickers of numbers. You can find some customize sticker service, or you can find some existing stickers. I found this Bonito crystal 3D stickers super helpful for this project.
* **aic_key_bottom.stl** <img src="doc/bonito_stickers.png" width="50%">
Bottom part. <img src="doc/bonito_action.jpg" width="50%">
* **aic_key_top_surface.stl**
Top part for Alps surface switches. * PCB, just visit JLCPCB (https://jlcpcb.com/) and place an order there. Leave everything default, 1.6mm thickness, whatever color you like. PCB gerber files are in "Production/PCB" folder. For PN532 version, use "aic_key_pn532_v*.zip", for PN5180 version, use "aic_key_pn5180_v*.zip".
* **aic_key_top_surface_ams.3mf** <img src="doc/pcbs.jpg" width="60%">
Top part for Alps surface switches, multi-color printing.
* **aic_key_top_tact.stl.stl** ### 3D Prints
Top part for Panasonic tact switches. * **aic_key_bottom.stl**
* **aic_key_top_tact_ams.3mf** Bottom part.
Top part for Panasonic tact switches, multi-color printing. * **aic_key_top_surface.stl**
Top part for Alps surface switches.
### Assembly * **aic_key_top_surface_ams.3mf**
Again I'll let these images do the talk. Remember to upload the firmware onto Raspberry Pi Pico before assemble. Top part for Alps surface switches, multi-color printing.
* **aic_key_top_tact.stl.stl**
#### General Part Top part for Panasonic tact switches.
<img src="doc/key_assemble_1a.jpg" width="30%"> * **aic_key_top_tact_ams.3mf**
<img src="doc/key_assemble_1b.jpg" width="30%"> Top part for Panasonic tact switches, multi-color printing.
<img src="doc/key_assemble_2.jpg" width="30%">
### Assembly
#### PN532 Version Again I'll let these images do the talk. Remember to upload the firmware onto Raspberry Pi Pico before assemble.
Remember set to I2C mode first.
#### General Part
<img src="doc/pn532_i2c.jpg" width="40%"> <img src="doc/key_assemble_1a.jpg" width="30%">
<img src="doc/key_assemble_3.jpg" width="80%"> <img src="doc/key_assemble_1b.jpg" width="30%">
<img src="doc/key_assemble_4.jpg" width="40%"> <img src="doc/key_assemble_2.jpg" width="30%">
<img src="doc/key_assemble_5.jpg" width="40%">
#### PN532 Version
#### PN5180 Version Remember set to I2C mode first.
You need to cut off the original antenna and use the one in our PCB.
<img src="doc/pn532_i2c.jpg" width="40%">
<img src="doc/key_assemble_6.jpg" width="40%"> <img src="doc/key_assemble_3.jpg" width="80%">
<img src="doc/key_assemble_7.jpg" width="40%"> <img src="doc/key_assemble_4.jpg" width="40%">
<img src="doc/key_assemble_8.jpg" width="40%"> <img src="doc/key_assemble_5.jpg" width="40%">
<img src="doc/key_assemble_9.jpg" width="40%">
#### PN5180 Version
#### Final Assembly You need to cut off the original antenna and use the one in our PCB.
You may use some instant adhesive to fix stickers.
<img src="doc/key_assemble_6.jpg" width="40%">
<img src="doc/key_assemble_10.jpg" width="46%"> <img src="doc/key_assemble_7.jpg" width="40%">
<img src="doc/pico_assemble_4.jpg" width="40%"> <img src="doc/key_assemble_8.jpg" width="40%">
<img src="doc/key_assemble_9.jpg" width="40%">
## Firmware
* UF2 file is in `Production\Firmware` folder. #### Final Assembly
* There're several ways to boot into firmware update mode: You may use some instant adhesive to fix stickers.
* For the new build, hold the BOOTSEL button while connect the USB to a PC, there will be a disk named "RPI-RP2" showed up. Drag the UF2 firmware binary file into it. That's it.
* If there's already a working firmware, you can use "update" command in command line to update the firmware in the future, so you don't need to open the housing. <img src="doc/key_assemble_10.jpg" width="46%">
* If there's already a working firmware later than 2023-12-02, you can also press "00" key and "·" key (or directly ground the GPIO10 and the GPIO11) at the same time when plug in the USB cable, it will boot into firmware update mode. <img src="doc/pico_assemble_4.jpg" width="40%">
* You can use this Web Serial Terminal to connect to the main USB serial port of the board which is the command line interface. (Note: "?" is for help)
https://googlechromelabs.github.io/serial-terminal/ ## Firmware
* Spicetools cardio (Card I/O) HID is supported; * UF2 file is in `Production\Firmware` folder.
* SEGA AIME protocol is supported on a second serial port. * There're several ways to boot into firmware update mode:
* Some command line commands: * For the new build, hold the BOOTSEL button while connect the USB to a PC, there will be a disk named "RPI-RP2" showed up. Drag the UF2 firmware binary file into it. That's it.
* "light \<rgb|led|both|off\>" to turn on or off the LEDs. * If there's already a working firmware, you can use "update" command in command line to update the firmware in the future, so you don't need to open the housing.
* "level <0..255> <0..255>" to adjust the brightness. * If there's already a working firmware later than 2023-12-02, you can also press "00" key and "·" key (or directly ground the GPIO10 and the GPIO11) at the same time when plug in the USB cable, it will boot into firmware update mode.
* "nfc" manually to detect cards. * You can use this Web Serial Terminal to connect to the main USB serial port of the board which is the command line interface. (Note: "?" is for help)
* "update" reboot into firmware update mode. https://googlechromelabs.github.io/serial-terminal/
* Given my limited hobby time, the firmware may not be fully tested. Please report any anomalies. * Spicetools cardio (Card I/O) HID is supported;
* SEGA AIME protocol is supported on a second serial port.
## Card ID Logic * Some command line commands:
To support many different NFC cards and tags, card IDs are transformed following these rules. * "light \<rgb|led|both|off\>" to turn on or off the LEDs.
### AIME * "level <0..255> <0..255>" to adjust the brightness.
* 15693 => 0x01 + last 7 bytes of UID * "nfc" manually to detect cards.
* MIFARE (4-byte UID) => 0x01 + 0x01 + UID + first 2 bytes of the UID * "update" reboot into firmware update mode.
* MIFARE (7-byte UID) => 0x01 + UID * Given my limited hobby time, the firmware may not be fully tested. Please report any anomalies.
* FeliCa => Original IDm
### CardIO ## Card ID Logic
* 15693 => original UID To support many different NFC cards and tags, card IDs are transformed following these rules.
* MIFARE (4-byte UID) => 0xE0 + 0x04 + UID + first 2 bytes of the UID ### AIME
* MIFARE (7-byte UID) => 0xE0 + UID * 15693 => 0x01 + last 7 bytes of UID
* FeliCa => Original IDm * MIFARE (4-byte UID) => 0x01 + 0x01 + UID + first 2 bytes of the UID
* MIFARE (7-byte UID) => 0x01 + UID
## 3D Model Source File (Onshape) * FeliCa => Original IDm
https://cad.onshape.com/documents/ca5497f91b2962105335e822/w/7b88022e98c02c60ad0c44a7/e/c3476efd13c08f807f3773fe?configuration=List_6ARRO0azcgmmHg%3D__&renderMode=1&rightPanel=configPanel&uiState=6558cabf9b380560ca5b554e ### CardIO
* 15693 => original UID
* MIFARE (4-byte UID) => 0xE0 + 0x04 + UID + first 2 bytes of the UID
* MIFARE (7-byte UID) => 0xE0 + UID
* FeliCa => Original IDm
### Bandai Namco
* MIFARE (4-byte UID) => UID
* FeliCa => Original IDm
## 3D Model Source File (Onshape)
https://cad.onshape.com/documents/ca5497f91b2962105335e822/w/7b88022e98c02c60ad0c44a7/e/c3476efd13c08f807f3773fe?configuration=List_6ARRO0azcgmmHg%3D__&renderMode=1&rightPanel=configPanel&uiState=6558cabf9b380560ca5b554e

View File

@ -1,223 +1,233 @@
# AIC Pico 和 AIC Key # AIC Pico 和 AIC Key
**AIC 卡读取器AIME & Cardio 模拟器** **AIME 读卡器 & Bandai Namco 读卡器 & Cardio 模拟器**
[Click here for the English version of this guide.](README.md) [Click here for the English version of this guide.](README.md)
<img src="doc/main.jpg" width="80%"> <img src="doc/main.jpg" width="80%">
为了省事,本文档是我从原先英文版翻译回中文的,高度依赖了 GitHub Copilot (GPT),所以语气可能怪怪的,见谅。 为了省事,本文档是我从原先英文版翻译回中文的,高度依赖了 GitHub Copilot (GPT),所以语气可能怪怪的,见谅。
**特性:** **特性:**
* 它很小,据我所知是最小的。 * 它很小,据我所知是最小的。
* 有许多变种: * 有许多变种:
* AIC Pico (PN532) * AIC Pico (PN532)
* AIC Pico (PN5180, 无壳) * AIC Pico (PN5180, 无壳)
* AIC Key PN532 * AIC Key PN532
* AIC Key PN5180 * AIC Key PN5180
* AIC Pico Lib (参见下面的注释 1) * AIC Pico Lib (参见下面的注释 1)
* 易于制作。 * 易于制作。
* Sega AIME I/O 和 Spicetools CardIO 模拟。 * Sega AIME I/O, Bandai Namco I/O 和 Spicetools CardIO 模拟。
* 用于参数配置的命令行。 * 用于参数配置的命令行。
* 支持的卡: * 支持的卡:
* FeliCa (Amusement IC) * FeliCa (Amusement IC)
* ISO/IEC 14443 类型 A (BanaPassport, Mifare, Amiibo, 一些 IC Tag 和 ID Tag 卡, 等等.) * ISO/IEC 14443 类型 A (BanaPassport, Mifare, Amiibo, 一些 IC Tag 和 ID Tag 卡, 等等.)
* ISO/IEC 15693 (旧的 E-Amusement 卡),仅 PN5180 支持 (参见下面的注释 2) * ISO/IEC 15693 (旧的 E-Amusement 卡),仅 PN5180 支持 (参见下面的注释 2)
* 从任何 Mifare 卡模拟虚拟 AIC。 * 从任何 Mifare 卡模拟虚拟 AIC。
* 所有源文件开放。 * 所有源文件开放。
**注释:** **注释:**
1. 这样就可以把 "AIC Pico" 集成到基于 Raspberry Pi Pico 的其他项目中。可以参考我的 Chu Pico 项目里的用法。 1. 这样就可以把 "AIC Pico" 集成到基于 Raspberry Pi Pico 的其他项目中。可以参考我的 Chu Pico 项目里的用法。
<img src="doc/aic_pico_lib.jpg" width="25%"> <img src="doc/aic_pico_lib.jpg" width="25%">
2. PN532 只支持 14443A (Mifare) 和 FeliCa 卡,而 PN5180 还支持 15693 卡(旧的 e-Amusement 卡)。 2. PN532 只支持 14443A (Mifare) 和 FeliCa 卡,而 PN5180 还支持 15693 卡(旧的 e-Amusement 卡)。
## 感谢 ## 感谢
感谢许多尊敬的爱好者和公司将他们的工具或材料免费或开源KiCad, OnShape, InkScape, Fritzing, Raspberry thingsChatGPT 和 GitHub Copilot 也提供了很大的帮助。 感谢许多尊敬的爱好者和公司将他们的工具或材料免费或开源KiCad, OnShape, InkScape, Fritzing, Raspberry thingsChatGPT 和 GitHub Copilot 也提供了很大的帮助。
同时感谢对我有很大帮助的社区开发者和项目CrazyRedMachine (https://github.com/CrazyRedMachine) 提供了 Spicetools Card IO 部分Sucareto 的 AIME Reader (https://github.com/Sucareto/Arduino-Aime-Reader) 提供了 AIME 协议部分Bottersnike (https://gitea.tendokyu.moe/Bottersnike) 提供了 AIME 和 FeliCa 相关的知识帮助, .NET nanoFramework (https://github.com/nanoframework) 提供了 PN5180 部分。 同时感谢对我有很大帮助的社区开发者和项目:
* CrazyRedMachine (https://github.com/CrazyRedMachine) 提供了 Spicetools Card IO 部分;
## 友情警告 * Sucareto 的 AIME Reader (https://github.com/Sucareto/Arduino-Aime-Reader) 提供了 AIME 协议部分;
这个项目: * Bottersnike (https://gitea.tendokyu.moe/Bottersnike, https://sega.bsnk.me/) 提供了 AIME 和 FeliCa 相关的知识;
* 严重依赖于3D打印Bambu AMS系统能够提供很大的帮助。 * .NET nanoFramework (https://github.com/nanoframework) 提供了 PN5180 部分;
* 需要有焊接微小组件和线路的技能。 * Gyt4 (https://github.com/gyt4/) 提供了 Bandai Namco 读卡器相关信息;
* Bananatools (https://gitea.tendokyu.moe/Hay1tsme/bananatools) 提供了 Bandai Namco 读卡器交互信息;
## 查看我的其他项目 * chujohiroto (https://github.com/chujohiroto/Raspberry-RCS620S/blob/master/rcs620s.py) RCS620 用作间接参考;
你也可以查看我其他的酷炫项目。
## 友情警告
<img src="https://github.com/whowechina/popn_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_teeny/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/chu_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/mai_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/diva_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/aic_pico/raw/main/doc/main.jpg" height="100px"> 这个项目:
* 严重依赖于3D打印Bambu AMS系统能够提供很大的帮助。
* Popn Pico: https://github.com/whowechina/popn_pico * 需要有焊接微小组件和线路的技能。
* IIDX Pico: https://github.com/whowechina/iidx_pico
* IIDX Teeny: https://github.com/whowechina/iidx_teeny ## 查看我的其他项目
* Chu Pico: https://github.com/whowechina/chu_pico 你也可以查看我其他的酷炫项目。
* Mai Pico: https://github.com/whowechina/mai_pico
* Diva Pico: https://github.com/whowechina/diva_pico <img src="https://github.com/whowechina/popn_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/iidx_teeny/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/chu_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/mai_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/diva_pico/raw/main/doc/main.jpg" height="100px"><img src="https://github.com/whowechina/aic_pico/raw/main/doc/main.jpg" height="100px">
* AIC Pico: https://github.com/whowechina/aic_pico
* Popn Pico: https://github.com/whowechina/popn_pico
## **声明** ## * IIDX Pico: https://github.com/whowechina/iidx_pico
我在个人时间内制作了这个项目,没有任何经济利益或赞助。我将继续改进这个项目。我已尽我所能确保所有内容的准确性和功能性,但总有可能出现错误。如果你因使用这个开源项目而造成时间或金钱的损失,我不能负责。感谢你的理解。 * IIDX Teeny: https://github.com/whowechina/iidx_teeny
* Chu Pico: https://github.com/whowechina/chu_pico
查看我 GitHub 主页,上面有很多其他项目。 * Mai Pico: https://github.com/whowechina/mai_pico
https://github.com/whowechina/ * Diva Pico: https://github.com/whowechina/diva_pico
* AIC Pico: https://github.com/whowechina/aic_pico
## 关于许可证
它是 CC-NC 授权。所以你只能给自己和你的朋友 DIY不能利用这个项目赚钱。 ## **声明** ##
我在个人时间内制作了这个项目,没有任何经济利益或赞助。我将继续改进这个项目。我已尽我所能确保所有内容的准确性和功能性,但总有可能出现错误。如果你因使用这个开源项目而造成时间或金钱的损失,我不能负责。感谢你的理解。
## 构建 "AIC Pico (PN532)"
说真的,这是我所有 Pico 系列项目中最简单的一个。 查看我 GitHub 主页,上面有很多其他项目。
### 组件 https://github.com/whowechina/
* 1x 树莓派 Pico 或 Pico W (克隆版也可以)。
https://www.raspberrypi.com/products/raspberry-pi-pico ## 关于许可证
* 1x PN532 模块 (红色方形板版本,便宜的克隆版也可以)。 它是 CC-NC 授权。所以你只能给自己和你的朋友 DIY不能利用这个项目赚钱。
https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 一些细一点的电线,软一点的硅胶线更好。 ## 构建 "AIC Pico (PN532)"
* 小巧的 WS2812B LED 灯条。 说真的,这是我所有 Pico 系列项目中最简单的一个。
* 4x M2*8mm 螺丝。 ### 组件
* 1x 树莓派 Pico 或 Pico W (克隆版也可以)。
### 3D 打印 https://www.raspberrypi.com/products/raspberry-pi-pico
* **aic_pico_bottom.stl** * 1x PN532 模块 (红色方形板版本,便宜的克隆版也可以)。
底部部分。 https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 一些细一点的电线,软一点的硅胶线更好。
对于顶部部分,选择适合你需求的一个。 * 小巧的 WS2812B LED 灯条。
* **aic_pico_top.stl** * 4x M2*8mm 螺丝。
常规顶部部分。
* **aic_pico_top_ams.3mf** ### 3D 打印
常规顶部部分,多色打印。 * **aic_pico_bottom.stl**
* **aic_pico_top_tall.stl** 底部部分。
加高的顶部部分,可以适应更厚的 LED 条。
* **aic_pico_top_tall_ams.3mf** 对于顶部部分,选择适合你需求的一个。
加高的顶部部分,多色打印。 * **aic_pico_top.stl**
常规顶部部分。
### 接线 * **aic_pico_top_ams.3mf**
<img src="doc/pico_pn532_wiring.png" width="70%"> 常规顶部部分,多色打印。
* **aic_pico_top_tall.stl**
### 组装 加高的顶部部分,可以适应更厚的 LED 条。
我会让这些图片来说明。 * **aic_pico_top_tall_ams.3mf**
加高的顶部部分,多色打印。
<img src="doc/pico_assemble_1.jpg" width="40%">
<img src="doc/pico_assemble_2.jpg" width="34%"> ### 接线
<img src="doc/pico_assemble_3.jpg" width="37%"> <img src="doc/pico_pn532_wiring.png" width="70%">
<img src="doc/pico_assemble_4.jpg" width="40%">
### 组装
#### 注意事项 我会让这些图片来说明。
* 固件支持最多 64 个 LED 的 WS2812B 灯条。我用了 3 个,如主标题图像所示。但你可以用不同数量的 LED只要它们能装进壳子里。
* 即使在低设置下LED 可能过于明亮,考虑用一些胶带覆盖它。 <img src="doc/pico_assemble_1.jpg" width="40%">
* PN532 上的模式开关必须处于 "I2C" 模式,下面的图片显示了正确的设置。 <img src="doc/pico_assemble_2.jpg" width="34%">
<img src="doc/pn532_i2c.jpg" width="40%"> <img src="doc/pico_assemble_3.jpg" width="37%">
<img src="doc/pico_assemble_4.jpg" width="40%">
## 构建 "AIC Pico (PN5180)"
如果你选择 PN5180 NFC 模块,壳子的设计要你自己来了,确保它适合你的要求就好,或者你可以不使用壳子。与 PN532 版本相比,准备好焊接更多的线。 #### 注意事项
* 固件支持最多 64 个 LED 的 WS2812B 灯条。我用了 3 个,如主标题图像所示。但你可以用不同数量的 LED只要它们能装进壳子里。
### 接线 * 即使在低设置下LED 可能过于明亮,考虑用一些胶带覆盖它。
<img src="doc/pico_pn5180_wiring.png" width="70%"> * PN532 上的模式开关必须处于 "I2C" 模式,下面的图片显示了正确的设置。
<img src="doc/pn532_i2c.jpg" width="40%">
注意WS2812B LED 条的接线与 PN532 版本相同。
## 构建 "AIC Pico (PN5180)"
## 构建 "AIC Key" 如果你选择 PN5180 NFC 模块,壳子的设计要你自己来了,确保它适合你的要求就好,或者你可以不使用壳子。与 PN532 版本相比,准备好焊接更多的线。
AIC Key 是 AIC Pico 的一个变种 - 集成了一个小键盘。比 "AIC Pico" 更难构建,因为它有许多微小的组件需要焊接。
### 接线
### 组件 <img src="doc/pico_pn5180_wiring.png" width="70%">
* 1x 树莓派 Pico 或 Pico W (克隆版也可以)。
https://www.raspberrypi.com/products/raspberry-pi-pico 注意WS2812B LED 条的接线与 PN532 版本相同。
* 对于 NFC 模块,选择以下选项之一: ## 构建 "AIC Key"
* 1x PN532 模块 (红色方形板版本,便宜的克隆版也可以)。 AIC Key 是 AIC Pico 的一个变种 - 集成了一个小键盘。比 "AIC Pico" 更难构建,因为它有许多微小的组件需要焊接。
https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 1x PN5180 模块 (蓝色矩形版本,便宜的克隆版也可以)。PN5180 支持 ISO/IEC 15693 (旧的 e-amusement 卡)。 ### 组件
<img src="doc/pn5180.jpg" width="50%"> * 1x 树莓派 Pico 或 Pico W (克隆版也可以)。
https://www.raspberrypi.com/products/raspberry-pi-pico
* 对于 LED你有 3 个选项:
* 选项 16x 侧光 WS2812B 1204 LEDD1 到 D6和一个 10ohm 0603 电阻R1在组装图像中标记为绿色。 * 对于 NFC 模块,选择以下选项之一:
* 选项 2仅适用于 PN532 版本6x WS2812C-2020 LEDD13 到 D18在组装图像中标记为蓝色。 * 1x PN532 模块 (红色方形板版本,便宜的克隆版也可以)。
* 选项 36x 常规单色 0603 LEDD7 到 D12和 6x 100ohm 0603 电阻R2 到 R7在组装图像中标记为紫色。 https://www.elechouse.com/product/pn532-nfc-rfid-module-v4/
* 1x PN5180 模块 (蓝色矩形版本,便宜的克隆版也可以)。PN5180 支持 ISO/IEC 15693 (旧的 e-amusement 卡)。
* 对于开关,你有 2 个选项: <img src="doc/pn5180.jpg" width="50%">
* 选项 112x ALPS SKRRAAE010 低调 TACT 开关。
https://www.mouser.com/ProductDetail/Alps-Alpine/SKRRAAE010?qs=m0BA540hBPeKhAe3239t1w%3D%3D * 对于 LED你有 3 个选项:
* 选项 212x Panasonic EVQP1K05M 6mm 方形触摸开关。 * 选项 16x 侧光 WS2812B 1204 LEDD1 到 D6和一个 10ohm 0603 电阻R1在组装图像中标记为绿色。
https://www3.panasonic.biz/ac/e/dl/catalog/index.jsp?series_cd=3473&part_no=EVQP1K05M * 选项 2仅适用于 PN532 版本6x WS2812C-2020 LEDD13 到 D18在组装图像中标记为蓝色。
* 选项 36x 常规单色 0603 LEDD7 到 D12和 6x 100ohm 0603 电阻R2 到 R7在组装图像中标记为紫色。
* 1x 右角 2.54mm 间距头PN532 为 4PPN5180 为 13P。
<img src="doc/right_angle_header.jpg" width="20%"> * 对于开关,你有 2 个选项:
* 选项 112x ALPS SKRRAAE010 低调 TACT 开关。
* 1x 数字贴纸。你可以找一些定制贴纸服务,或者你可以找一些现有的贴纸。我发现这个 Bonito 水晶 3D 贴纸对这个项目非常有帮助。 https://www.mouser.com/ProductDetail/Alps-Alpine/SKRRAAE010?qs=m0BA540hBPeKhAe3239t1w%3D%3D
<img src="doc/bonito_stickers.png" width="50%"> * 选项 212x Panasonic EVQP1K05M 6mm 方形触摸开关。
<img src="doc/bonito_action.jpg" width="50%"> https://www3.panasonic.biz/ac/e/dl/catalog/index.jsp?series_cd=3473&part_no=EVQP1K05M
* PCB只需访问 JLCPCB (https://jlcpcb.com/) 并在那里下订单。保持所有设置默认1.6mm 厚度你喜欢的任何颜色。PCB gerber 文件在 "Production/PCB" 文件夹。对于 PN532 版本,使用 "aic_key_pn532_v*.zip",对于 PN5180 版本,使用 "aic_key_pn5180_v*.zip"。 * 1x 右角 2.54mm 间距头PN532 为 4PPN5180 为 13P。
<img src="doc/pcbs.jpg" width="60%"> <img src="doc/right_angle_header.jpg" width="20%">
### 3D 打印 * 1x 数字贴纸。你可以找一些定制贴纸服务,或者你可以找一些现有的贴纸。我发现这个 Bonito 水晶 3D 贴纸对这个项目非常有帮助。
* **aic_key_bottom.stl** <img src="doc/bonito_stickers.png" width="50%">
底部部分。 <img src="doc/bonito_action.jpg" width="50%">
* **aic_key_top_surface.stl**
适用于 Alps 表面开关的顶部部分。 * PCB只需访问 JLCPCB (https://jlcpcb.com/) 并在那里下订单。保持所有设置默认1.6mm 厚度你喜欢的任何颜色。PCB gerber 文件在 "Production/PCB" 文件夹。对于 PN532 版本,使用 "aic_key_pn532_v*.zip",对于 PN5180 版本,使用 "aic_key_pn5180_v*.zip"。
* **aic_key_top_surface_ams.3mf** <img src="doc/pcbs.jpg" width="60%">
适用于 Alps 表面开关的顶部部分,多色打印。
* **aic_key_top_tact.stl.stl** ### 3D 打印
适用于 Panasonic tact 开关的顶部部分。 * **aic_key_bottom.stl**
* **aic_key_top_tact_ams.3mf** 底部部分。
适用于 Panasonic tact 开关的顶部部分,多色打印。 * **aic_key_top_surface.stl**
适用于 Alps 表面开关的顶部部分。
### 组装 * **aic_key_top_surface_ams.3mf**
我还是让这些图片来说明。记住在组装之前先将固件上传到树莓派 Pico。 适用于 Alps 表面开关的顶部部分,多色打印。
* **aic_key_top_tact.stl.stl**
#### 通用部分 适用于 Panasonic tact 开关的顶部部分。
<img src="doc/key_assemble_1a.jpg" width="30%"> * **aic_key_top_tact_ams.3mf**
<img src="doc/key_assemble_1b.jpg" width="30%"> 适用于 Panasonic tact 开关的顶部部分,多色打印。
<img src="doc/key_assemble_2.jpg" width="30%">
### 组装
#### PN532 版本 我还是让这些图片来说明。记住在组装之前先将固件上传到树莓派 Pico。
记住首先设置为 I2C 模式。
#### 通用部分
<img src="doc/pn532_i2c.jpg" width="40%"> <img src="doc/key_assemble_1a.jpg" width="30%">
<img src="doc/key_assemble_3.jpg" width="80%"> <img src="doc/key_assemble_1b.jpg" width="30%">
<img src="doc/key_assemble_4.jpg" width="40%"> <img src="doc/key_assemble_2.jpg" width="30%">
<img src="doc/key_assemble_5.jpg" width="40%">
#### PN532 版本
#### PN5180 版本 记住首先设置为 I2C 模式。
你需要切掉原来的天线并使用我们 PCB 中的天线。
<img src="doc/pn532_i2c.jpg" width="40%">
<img src="doc/key_assemble_6.jpg" width="40%"> <img src="doc/key_assemble_3.jpg" width="80%">
<img src="doc/key_assemble_7.jpg" width="40%"> <img src="doc/key_assemble_4.jpg" width="40%">
<img src="doc/key_assemble_8.jpg" width="40%"> <img src="doc/key_assemble_5.jpg" width="40%">
<img src="doc/key_assemble_9.jpg" width="40%">
#### PN5180 版本
#### Final Assembly 你需要切掉原来的天线并使用我们 PCB 中的天线。
你可以使用一些强力胶水来固定贴纸。
<img src="doc/key_assemble_6.jpg" width="40%">
<img src="doc/key_assemble_10.jpg" width="46%"> <img src="doc/key_assemble_7.jpg" width="40%">
<img src="doc/pico_assemble_4.jpg" width="40%"> <img src="doc/key_assemble_8.jpg" width="40%">
<img src="doc/key_assemble_9.jpg" width="40%">
## 固件
* UF2 文件在 `Production\Firmware` 文件夹中。 #### Final Assembly
* 有几种方法可以进入固件更新模式: 你可以使用一些强力胶水来固定贴纸。
* 对于新构建,握住 BOOTSEL 按钮,同时将 USB 连接到 PC会出现一个名为 "RPI-RP2" 的磁盘。将 UF2 固件二进制文件拖入其中。这样就 OK 了。
* 如果已经上传过可用的的固件,你可以在命令行中使用 "update" 命令来更新未来的固件,这样你就不需要打开外壳。 <img src="doc/key_assemble_10.jpg" width="46%">
* 如果已经有一个在 2023-12-02 之后的工作固件,你也可以在插入 USB 线时同时按下 "00" 键和 "·" 键(或直接接地 GPIO10 和 GPIO11它将进入固件更新模式。 <img src="doc/pico_assemble_4.jpg" width="40%">
* 你可以使用这个 Web Serial Terminal 来连接到板的主 USB 串行端口来访问命令行。(注意:"?" 是帮助)
https://googlechromelabs.github.io/serial-terminal/ ## 固件
* 支持 Spicetools cardio (Card I/O) HID。 * UF2 文件在 `Production\Firmware` 文件夹中。
* 在第二个串行端口上跑的是 SEGA AIME 协议。 * 有几种方法可以进入固件更新模式:
* 一些命令行命令: * 对于新构建,握住 BOOTSEL 按钮,同时将 USB 连接到 PC会出现一个名为 "RPI-RP2" 的磁盘。将 UF2 固件二进制文件拖入其中。这样就 OK 了。
* "light \<rgb|led|both|off\>" 来打开或关闭 LED。 * 如果已经上传过可用的的固件,你可以在命令行中使用 "update" 命令来更新未来的固件,这样你就不需要打开外壳。
* "level <0..255> <0..255>" 来调整亮度。 * 如果已经有一个在 2023-12-02 之后的工作固件,你也可以在插入 USB 线时同时按下 "00" 键和 "·" 键(或直接接地 GPIO10 和 GPIO11它将进入固件更新模式。
* "nfc" 手动检测卡片。 * 你可以使用这个 Web Serial Terminal 来连接到板的主 USB 串行端口来访问命令行。(注意:"?" 是帮助)
* "update" 重启进入固件更新模式。 https://googlechromelabs.github.io/serial-terminal/
* 鉴于我的业余时间有限,固件可能没有完全测试。请报告任何异常。 * 支持 Spicetools cardio (Card I/O) HID。
* 在第二个串行端口上跑的是 SEGA AIME 协议。
## 卡的 ID 生成逻辑 * 一些命令行命令:
为了支持许多不同的 NFC 卡和标签,卡 ID 按照以下规则进行转换。 * "light \<rgb|led|both|off\>" 来打开或关闭 LED。
### AIME * "level <0..255> <0..255>" 来调整亮度。
* 15693 => 0x01 + UID 的最后 7 个字节 * "nfc" 手动检测卡片。
* MIFARE (4-byte UID) => 0x01 + 0x01 + UID + UID 的前 2 个字节 * "update" 重启进入固件更新模式。
* MIFARE (7-byte UID) => 0x01 + UID * 鉴于我的业余时间有限,固件可能没有完全测试。请报告任何异常。
* FeliCa => 原始 IDm
### CardIO ## 卡的 ID 生成逻辑
* 15693 => 原始 UID 为了支持许多不同的 NFC 卡和标签,卡 ID 按照以下规则进行转换。
* MIFARE (4-byte UID) => 0xE0 + 0x04 + UID + UID 的前 2 个字节 ### AIME
* MIFARE (7-byte UID) => 0xE0 + UID * 15693 => 0x01 + UID 的最后 7 个字节
* FeliCa => 原始 IDm * MIFARE (4-byte UID) => 0x01 + 0x01 + UID + UID 的前 2 个字节
* MIFARE (7-byte UID) => 0x01 + UID
## 3D 模型源文件 (Onshape) * FeliCa => 原始 IDm
https://cad.onshape.com/documents/ca5497f91b2962105335e822/w/7b88022e98c02c60ad0c44a7/e/c3476efd13c08f807f3773fe?configuration=List_6ARRO0azcgmmHg%3D__&renderMode=1&rightPanel=configPanel&uiState=6558cabf9b380560ca5b554e ### CardIO
* 15693 => 原始 UID
* MIFARE (4-byte UID) => 0xE0 + 0x04 + UID + UID 的前 2 个字节
* MIFARE (7-byte UID) => 0xE0 + UID
* FeliCa => 原始 IDm
### Bandai Namco
* MIFARE (4-byte UID) => UID
* FeliCa => 原始 IDm
## 3D 模型源文件 (Onshape)
https://cad.onshape.com/documents/ca5497f91b2962105335e822/w/7b88022e98c02c60ad0c44a7/e/c3476efd13c08f807f3773fe?configuration=List_6ARRO0azcgmmHg%3D__&renderMode=1&rightPanel=configPanel&uiState=6558cabf9b380560ca5b554e

View File

@ -5,11 +5,12 @@
* Use NFC Module to read BANA * Use NFC Module to read BANA
*/ */
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <string.h>
#include "bsp/board.h"
#include "hardware/gpio.h" #include "hardware/gpio.h"
#include "hardware/i2c.h" #include "hardware/i2c.h"
@ -55,9 +56,27 @@ typedef union __attribute__((packed)) {
uint8_t cmd; uint8_t cmd;
uint8_t data[0]; uint8_t data[0];
}; };
uint8_t raw[48]; uint8_t raw[128];
} message_t; } message_t;
typedef struct __attribute__((packed)) {
uint8_t card_present;
uint8_t num;
uint8_t atqa[2];
union {
struct {
uint8_t sak;
uint8_t unk;
uint8_t uid[4];
} mifare;
struct {
uint8_t idm[8];
uint8_t pmm[8];
uint8_t system_code[2];
} felica;
};
} card_report_t;
static message_t request, response; static message_t request, response;
struct { struct {
@ -96,39 +115,287 @@ static void send_response()
int total_len = 7 + response.hdr.len; int total_len = 7 + response.hdr.len;
bana_puts((const char *)response.raw, total_len); bana_puts((const char *)response.raw, total_len);
DEBUG("\n\033[33mResp: %2d %2x >>", response.hdr.len, response.cmd); DEBUG("\n\033[33mResp %2d:%02x >>", response.hdr.len - 2, response.cmd);
for (int i = 0; i < total_len; i++) { for (int i = 0; i < response.hdr.len - 2; i++) {
DEBUG(" %02x", response.raw[i]); DEBUG(" %02x", response.data[i]);
} }
DEBUG("\033[0m"); DEBUG("\033[0m");
} }
static void send_simple_response(uint8_t code) static void send_response_data(const void *data, int len)
{ {
response.hdr.len = 2; response.hdr.len = 2 + len;
response.dir = 0xd5; response.dir = 0xd5;
response.cmd = code; response.cmd = request.cmd + 1;
if (len) {
memcpy(response.data, data, len);
}
send_response(); send_response();
} }
static void send_simple_response()
{
send_response_data(NULL, 0);
}
static void send_ack() static void send_ack()
{ {
bana_puts("\x00\x00\xff\x00\xff\x00", 6); bana_puts("\x00\x00\xff\x00\xff\x00", 6);
} }
static void cmd_gpio()
{
if (request.data[0] == 0x08) {
} else if (request.data[0] == 0x01) {
} else {
}
send_simple_response(0x0e);
}
static void cmd_rf_field()
{
if (memcmp(request.data, "\x01\x00", 2) == 0) {
nfc_rf_field(false);
} else {
nfc_rf_field(true);
}
send_simple_response(request.cmd);
}
static void handle_mifare(const uint8_t uid[4])
{
card_report_t card;
card.card_present = 1;
card.num = 1;
card.atqa[0] = 0x00;
card.atqa[1] = 0x04;
card.mifare.sak = 0x08;
card.mifare.unk = 0x04;
memcpy(card.mifare.uid, uid, 4);
send_response_data(&card, 10);
}
static void handle_felica(const uint8_t idm[8], const uint8_t pmm[8],
const uint8_t system_code[2])
{
card_report_t card;
card.card_present = 1;
card.num = 1;
card.atqa[0] = 0x14;
card.atqa[1] = 0x01;
memcpy(card.felica.idm, idm, 8);
memcpy(card.felica.pmm, pmm, 8);
memcpy(card.felica.system_code, system_code, 2);
send_response_data(&card, sizeof(card));
}
static void handle_no_card()
{
send_response_data("\x00\x00\x00", 3);
}
static void cmd_poll_card()
{
send_ack();
nfc_card_t card = nfc_detect_card_ex(true, true, false);
if (debug) {
display_card(&card);
}
switch (card.card_type) {
case NFC_CARD_MIFARE:
handle_mifare(card.uid);
break;
case NFC_CARD_FELICA:
handle_felica(card.uid, card.pmm, card.syscode);
break;
default:
handle_no_card();
break;
}
}
static void cmd_mifare_auth(uint8_t key_id)
{
typedef struct __attribute__((packed)) {
uint8_t unk;
uint8_t cmd;
uint8_t block;
uint8_t key[6];
uint8_t uid[4];
} auth_t;
auth_t *auth = (auth_t *)request.data;
if (nfc_mifare_auth(auth->uid, auth->block, key_id, auth->key)) {
send_response_data("\x00", 1);
} else {
send_response_data("\x01", 1);
}
}
static void cmd_mifare_read()
{
typedef struct __attribute__((packed)) {
uint8_t unk;
uint8_t cmd;
uint8_t block;
} read_t;
read_t *read = (read_t *)request.data;
struct __attribute__((packed)) {
uint8_t status;
uint8_t data[16];
} resp;
if (nfc_mifare_read(read->block, resp.data)) {
resp.status = 0;
send_response_data(&resp, sizeof(resp));
} else {
send_response_data("\x14", 1);
}
}
static void cmd_mifare()
{
switch (request.data[1]) {
case 0x60:
cmd_mifare_auth(0);
break;
case 0x61:
cmd_mifare_auth(1);
break;
case 0x30:
cmd_mifare_read();
break;
default:
DEBUG("\nUnknown mifare cmd: %02x\n", request.data[0]);
send_ack();
break;
}
}
/* https://github.com/chujohiroto/Raspberry-RCS620S/blob/master/rcs620s.py */
static void cmd_felica_read(void *read_req)
{
typedef struct __attribute__((packed)) {
uint8_t idm[8];
uint8_t service_num;
uint8_t service[2];
uint8_t block_num;
uint8_t block[0][2];
} read_t;
read_t *read = (read_t *)(request.data + 4);
struct __attribute__((packed)) {
uint8_t status;
uint8_t len;
uint8_t cmd;
uint8_t idm[8];
uint8_t service[2];
uint8_t block_num;
uint8_t block[4][16];
} resp;
send_ack();
int block_num = read->block_num;
DEBUG("\nFelica read: ");
block_num = (block_num > 4) ? 4: block_num;
resp.status = 0;
resp.len = 2 + 8 + 2 + 1 + block_num * 16;
memset(resp.service, 0, 2);
resp.block_num = block_num;
resp.cmd = 0x07;
memcpy(resp.idm, read->idm, 8);
for (int i = 0; i < block_num; i++) {
uint16_t service = read->service[0] | (read->service[1] << 8);
uint16_t block = (read->block[i][0] << 8) | read->block[i][1];
DEBUG("[%04x %04x]", service, block);
if (!nfc_felica_read(service, block, resp.block[i])) {
DEBUG(":ERR");
}
}
send_response_data(&resp, 3 + 8 + 2 + 1 + block_num * 16);
}
static void cmd_felica()
{
typedef struct __attribute__((packed)) {
uint16_t timeout;
uint8_t len;
uint8_t cmd;
uint8_t data[0];
} felica_t;
felica_t *felica = (felica_t *)request.data;
if ((felica->cmd == 0x06) && (felica->len = request.hdr.len - 2)) {
cmd_felica_read(felica->data);
} else {
DEBUG("\nBad felica cmd: %02x %d", felica->cmd, felica->len);
}
}
static uint32_t led_color = 0; static uint32_t led_color = 0;
static void handle_frame() static void handle_frame()
{ {
DEBUG("\nBana >>"); DEBUG("\n\033[32mBana %d:%02x >>", request.hdr.len - 2, request.cmd);
for (int i = 0; i < request.hdr.len - 2; i++) {
for (int i = 3; i < request.hdr.len; i++) {
DEBUG(" %02x", request.data[i]); DEBUG(" %02x", request.data[i]);
} }
DEBUG("\033[0m");
if (request.hdr.len != 0) { switch (request.cmd) {
send_ack(); case 0x18:
send_simple_response(request.cmd + 1); case 0x12:
send_simple_response(request.cmd);
break;
case 0x0e:
cmd_gpio();
break;
case 0x08:
nfc_rf_field(false);
send_response_data("\0", 1);
break;
case 0x06:
if (request.data[1] == 0x1c) {
send_response_data("\xff\x3f\x0e\xf1\xff\x3f\x0e\xf1", 8);
} else {
send_response_data("\xdc\xf4\x3f\x11\x4d\x85\x61\xf1\x26\x6a\x87", 11);
}
break;
case 0x32:
cmd_rf_field();
break;
case 0x0c:
send_response_data("\x00\x06\x00", 3);
break;
case 0x4a:
cmd_poll_card();
break;
case 0x40:
cmd_mifare();
break;
case 0x44:
send_response_data("\x01\x00", 2);
break;
case 0xa0:
cmd_felica();
break;
case 0x52:
send_response_data("\x01\x00", 2);
break;
case 0x54:
send_response_data("\x00", 1);
break;
default:
printf("\nUnknown cmd: %02x\n", request.cmd);
send_ack();
break;
} }
} }

View File

@ -0,0 +1,28 @@
KONAMI:
IDM: 01 2e 48 b1 35 03 61 3c
PMM: 00 f1 00 00 00 01 43 00
SYS: 88 b4
8082: 01 2e 48 b1 35 03 61 3c 00 68 05 73 02 01 01 00
07 01 2e 48 b1 35 03 61 3c 01 b2
8082: 01 2e 48 b1 35 03 61 3c 00 68 05 73 02 01 01 00
8086: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8091: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8000: ce d6 6f 8f 43 d7 25 ad 9f a7 d9 6c 44 b5 1f 3d
AIME:
IDM: 01 2e 55 22 6d 99 c4 80
PMM: 00 f1 00 00 00 01 43 00
SYS: 88 b4
8082: 01 2e 55 22 6d 99 c4 80 00 78 00 00 00 00 00 00
8086: 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8091: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
8000: b2 51 89 1c 93 4e 65 19 03 84 b6 86 b4 14 a2 ea
e8 03 12 06 [01 2e 48 b1 35 03 61 3c] 01 0b 00 02 | 80 82 80 00
timeout len 17 + 1 idm
00 2d 07 01 2e 48 b1 35 03 61 3c | 00 00 02 |01 2e 48 b1 35 03 61 3c | 00 68 05 73 | 02 01 01 00 | ce d6 6f 8f | 43 d7 25 ad | 9f a7 d9 6c | 44 b5 1f 3d |
00 2D 07 [01 2***8 74 6C] 00 00 02 [01 2E 55 14 E***0 00 00] [2B DE C1 *** BB CA 1D] 8C