An open API service indexing awesome lists of open source software.

https://github.com/venkatesh4009/rfid-rc522-linux-driver

This project provides a complete Linux kernel driver and integration guide for interfacing the RC522 RFID module with the A5D2X Rugged Board via the SPI interface. It includes kernel-mode driver source code, device tree updates, patch generation, and a user-space test application. The main goal is to enable seamless RFID communication on embedded
https://github.com/venkatesh4009/rfid-rc522-linux-driver

a5d2x cross-compilation-toolchain device-tree embedded-linux kernel-modules linux-driver linux-kernel patch-generation rc522-rfid spi-driver yocto

Last synced: 3 months ago
JSON representation

This project provides a complete Linux kernel driver and integration guide for interfacing the RC522 RFID module with the A5D2X Rugged Board via the SPI interface. It includes kernel-mode driver source code, device tree updates, patch generation, and a user-space test application. The main goal is to enable seamless RFID communication on embedded

Awesome Lists containing this project

README

          

# ๐Ÿ› ๏ธ RFID RC522 Linux Driver for A5D2X

This repository contains a Linux kernel driver and integration guide for the **RC522 RFID module** on the **A5D2X (Rugged Board)** using SPI interface. It includes kernel driver source, device tree patching, and testing procedures.

---

## ๐Ÿ“ฆ Project Structure

```text
rfid-rc522-linux-driver/
โ”œโ”€โ”€ rfid_rc522/ # Kernel driver source folder
โ”‚ โ”œโ”€โ”€ rc522.c
โ”‚ โ”œโ”€โ”€ rc522_api.c
โ”‚ โ”œโ”€โ”€ rc522_api.h
โ”‚ โ”œโ”€โ”€ Makefile
โ”‚ โ””โ”€โ”€ Kconfig
โ”œโ”€โ”€ rfid_rc522_dev.c # User-space test application
โ”œโ”€โ”€ driver-readme # Developer notes
โ”œโ”€โ”€ 0001-Rb-a5d2x.dtsi.patch # Device tree patch
โ”œโ”€โ”€ 0002-rfid-rc522_driver.patch # Driver patch
โ”œโ”€โ”€ Integration_rfid-rc522.pdf # Driver integration guide
โ””โ”€โ”€ rfid-rc522_Generating_patch.pdf # Patch generation guide

```

### โš™๏ธ Hardware Requirements

- ๐Ÿ“Ÿ RC522 RFID Module (SPI)
- ๐Ÿ’ป RB-A5D2X (Rugged Board)
- ๐Ÿ”Œ SPI-connected via mikroBUS (VCC, MISO, MOSI, SCK, CS, RST, GND)
- ๐Ÿท๏ธ RFID Tags

---

### ๐Ÿ”ง Software Requirements

- ๐Ÿง Linux kernel source for RB-A5D2X
- ๐Ÿ› ๏ธ Yocto or similar toolchain setup
- ๐Ÿ“ฆ Git, GCC, Device Tree tools
- ๐Ÿงฐ Cross-compilation environment (e.g. poky-tiny)

---

### ๐Ÿš€ Driver Integration (Kernel Static Build)

### ๐Ÿ“ 1. Copy driver files into kernel

```bash
Place files into `/drivers/misc/rfid_rc522/`:

- rc522.c
- rc522_api.c
- rc522_api.h
- Kconfig
- Makefile
```

### ๐Ÿ› ๏ธ 2. Modify kernel Kconfig & Makefile

```bash
$ Edit `drivers/misc/Kconfig`:
$ source "drivers/misc/rfid_rc522/Kconfig"
```

```bash
$ Edit drivers/misc/Makefile:
obj-y += rfid_rc522/
```

### ๐ŸŒฒ 3. Update device tree
```bash
Modify a5d2x-rugged_board_common.dtsi to include SPI node and pinctrl for RC522.
```

### ๐Ÿ—๏ธ 4. Recompile kernel

```bash
$ source /opt/poky-tiny/2.5.2/environment-setup-cortexa5hf-neon-poky-linux-musleabi
$ make distclean
$ make rb_a5d2x_defconfig
$ make menuconfig # Enable RFID_RC522
$ make
```

### ๐Ÿ’พ 5. Copy artifacts to SD card
- Replace zImage and .dtb files in the boot partition with newly built ones.

### ๐Ÿงช Testing the Driver
### ๐Ÿ” 1. Boot and check device
```bash
$ ls /dev/rfid_rc522_dev
```

### ๐Ÿงฐ 2. Compile & send test app
```bash
$ {CC} rfid_rc522_dev.c -o rfid_rc522_dev
$ scp rfid_rc522_dev root@:/home/root
```

### โ–ถ๏ธ 3. Run on board
```bash
$ chmod +x rfid_rc522_dev
$ ./rfid_rc522_dev
```

### ๐Ÿงต Patch Generation (Optional)
```bash
To create patches:

git add drivers/misc/rfid_rc522/
git commit -m "Add RC522 RFID driver"
git format-patch -p1 -o patches/
```

### To apply patch later:
```bash
$ git am 0001-rfid-rc522_driver.patch
```

### ๐Ÿ“„ Documentation
### ๐Ÿ“˜ Integration_rfid-rc522.pdf โ€” Full hardware & software integration guide
### ๐Ÿ“˜ rfid-rc522_Generating_patch.pdf โ€” Kernel patch generation steps

---

๐Ÿ‘จโ€๐Ÿ’ผ Author

Developed by:

Venkatesh M โ€“ venkatesh.m@phytecembedded.com

Embedded System Engineer

---