Directory | Description |
---|---|
doc | Reference documentation |
img | Images |
script | Maixpy script example |
src | C program example based on the standalone sdk |
The FM17510 used in this module is a highly integrated non-contact reader chip working at 13.56MHz. Supports non-contact reader mode in accordance with ISO/IEC 14443 protocol,
64Byte TRANSCeiver buffer FIFO.
See Module Specification for more information.
MCU:FUN(IO) | SP_RFID |
---|---|
NC(IO_7) | NPD |
SPI:MISO(IO_15) | SO |
SPI:SS0(IO_20) | CS |
SPI:SCK(IO_21) | SCK |
SPI:MOSI(IO_8) | SI |
NC(IO_6) | IRQ |
2.2~3.6V | 3.3V |
GND | GND |
Configure IO port corresponding to MCU as SPI function pin.
-
C
This demo uses a software SPI, so set the corresponding pin to GPIOHS instead of SPI function. See the full code for the implementation.
fpioa_set_function(RFID_CS_PIN, FUNC_GPIOHS0 + RFID_CS_HSNUM); // RFID_CS_PIN: 20; fpioa_set_function(RFID_CK_PIN, FUNC_GPIOHS0 + RFID_CK_HSNUM); // RFID_CK_PIN: 21; fpioa_set_function(RFID_MO_PIN, FUNC_GPIOHS0 + RFID_MO_HSNUM); // RFID_MO_PIN: 8; fpioa_set_function(RFID_MI_PIN, FUNC_GPIOHS0 + RFID_MI_HSNUM); // RFID_MI_PIN: 15; gpiohs_set_drive_mode(spi_io_cfg.hs_cs, GPIO_DM_OUTPUT); gpiohs_set_drive_mode(spi_io_cfg.hs_clk, GPIO_DM_OUTPUT); gpiohs_set_drive_mode(spi_io_cfg.hs_mosi, GPIO_DM_OUTPUT); gpiohs_set_drive_mode(spi_io_cfg.hs_miso, GPIO_DM_INPUT);
-
MaixPy
# 20: CS_NUM; fm.register(20, fm.fpioa.GPIOHS20, force=True) # set gpiohs work mode to output mode cs = GPIO(GPIO.GPIOHS20, GPIO.OUT)
-
C
The software SPI only needs to be configured with the corresponding pins, and there is no initialization of SPI.
-
MaixPy
# RFID_SCK: 21; RFID_SI:8; RFID_SO: 15; spi1 = SPI(SPI.SPI1, mode=SPI.MODE_MASTER, baudrate=600 * 1000, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, sck=21, mosi=8, miso=15)
-
Process
- Initialization
- Detected and bind card
- Read or write data
-
C
// detected card PcdRequest(0x52, type) // auth and bind... // read or write 16 bytes data from sector 0x11 PcdWrite(0x11, w_buf) PcdRead(0x11, &r_buf)
-
MaixPy
# Create an object of the class MFRC522 MIFAREReader = MFRC522(spi1, cs) # detected and auth, bind... # read or write 16 bytes data from sector 0x11 MIFAREReader.MFRC522_Write(0x11, data) MIFAREReader.MFRC522_Read(0x11)
Language | Boards | SDK/Firmware version |
---|---|---|
C | MaixCube | kendryte-standalone-sdk v0.5.6 |
MaixPy | MaixCube | maixpy v0.5.1 |
The following parameters need to be modified.
-
C
// board_config.h #define RFID_CS_PIN (20) #define RFID_CK_PIN (21) #define RFID_MO_PIN (8) #define RFID_MI_PIN (15) #define RFID_CS_HSNUM (20) #define RFID_CK_HSNUM (21) #define RFID_MO_HSNUM (8) #define RFID_MI_HSNUM (15)
-
MaixPy
################### config ################### CS_NUM = const(20) SPI_FREQ_KHZ = const(600) SPI_SCK = const(21) SPI_MOSI = const(8) SPI_MISO = const(15) #############################################
See LICENSE file.
Version | Editor | Date |
---|---|---|
v1.0 | vamoosebbf | 2020.12.2 |