Update README.md to enhance documentation and clarify firmware operation details
This commit is contained in:
@@ -1,2 +1,66 @@
|
|||||||
# LightTAM_RFID_Reader
|
# LightTAM RFID Reader
|
||||||
|
|
||||||
|
This is firmware for an RFID reader for the LightTAM software. The LightTAM repository is [here](https://git.edcs.cz/eduard.dlabal). The LightTAM RFID Reader is built using an STM32F103C8 controller (mainly sold on BluePill boards), a PN532 RFID reader, and an HD44780 LCD display for the I2C bus. MCU is programmed using STM32Cube with CMake and HAL libraries. For editing (or debugging), I recommend using VS Code with STM32Cube extension installed.
|
||||||
|
|
||||||
|
This program utilizes libraries from these repositories:
|
||||||
|
- [STM32_HAL_I2C_HD44780](https://github.com/eziya/STM32_HAL_I2C_HD44780)
|
||||||
|
- [pn532-lib](https://github.com/soonuse/pn532-lib)
|
||||||
|
|
||||||
|
## Hardware Connection
|
||||||
|
|
||||||
|
- **PN532 RFID Reader**: Connected via UART or I2C (depending on configuration).
|
||||||
|
- **HD44780 LCD Display**: Connected via I2C using a PCF8574 I/O expander.
|
||||||
|
- **Three LEDs**: Connected to PB12 (red), PB13 (yellow), and PB14 (green).
|
||||||
|
- **Power Supply**: 5V input, regulated to 3.3V for the STM32 and peripherals.
|
||||||
|
|
||||||
|
### Wiring
|
||||||
|
|
||||||
|
| Device | STM32 Pin | Notes |
|
||||||
|
|----------------|---------------|----------------------|
|
||||||
|
| PN532 (I2C) | PB6 (SCL) | I2C1 SCL |
|
||||||
|
| | PB7 (SDA) | I2C1 SDA |
|
||||||
|
| LCD (I2C) | PB6 (SCL) | Shared I2C bus |
|
||||||
|
| | PB7 (SDA) | Shared I2C bus |
|
||||||
|
| LED Red | PB12 | |
|
||||||
|
| LED Yellow | PB13 | |
|
||||||
|
| LED Green | PB14 | |
|
||||||
|
| Computer (RXD) | A2 | USART2 TX
|
||||||
|
Computer (TXD) | A3 | USART2 RX |
|
||||||
|
|Debug (RXD)|PA9|USART1 TX
|
||||||
|
|Debug (TXD)|PA10|USART1 TX
|
||||||
|
|
||||||
|
## Firmware Operation
|
||||||
|
|
||||||
|
After startup, the firmware initializes all peripherals: I2C, GPIOs, the LCD display, and the PN532 RFID reader. The main loop performs the following steps:
|
||||||
|
|
||||||
|
1. **Idle State**:
|
||||||
|
- The green LED (PB14) is ON, indicating the system is ready to scan for RFID tags.
|
||||||
|
- The LCD displays a welcome or ready message.
|
||||||
|
|
||||||
|
2. **RFID Scanning**:
|
||||||
|
- The firmware continuously polls the PN532 for the presence of an RFID tag.
|
||||||
|
|
||||||
|
3. **Tag Detection**:
|
||||||
|
- When a tag is detected, the UID is read.
|
||||||
|
- The yellow LED (PB13) briefly turns ON to indicate a tag is being processed.
|
||||||
|
- The LCD displays the UID or relevant information.
|
||||||
|
|
||||||
|
4. **Tag Validation**:
|
||||||
|
- The firmware checks if the tag UID is valid (e.g., against a list or via communication with the host).
|
||||||
|
- If the tag is valid, the green LED (PB14) blinks or stays ON.
|
||||||
|
- If the tag is invalid, the red LED (PB12) turns ON to indicate an error or unauthorized tag.
|
||||||
|
|
||||||
|
5. **Status Indication**:
|
||||||
|
- The LEDs provide immediate feedback:
|
||||||
|
- **Green (PB14)**: System ready or access granted.
|
||||||
|
- **Yellow (PB13)**: Tag detected and being processed.
|
||||||
|
- **Red (PB12)**: Error or access denied.
|
||||||
|
|
||||||
|
6. **Communication**:
|
||||||
|
- The firmware can send the UID or status to a host system via UART or another interface if required.
|
||||||
|
|
||||||
|
7. **Return to Idle**:
|
||||||
|
- After processing, the system returns to the idle state, with the green LED ON and others OFF.
|
||||||
|
|
||||||
|
All logic is implemented using STM32Cube HAL libraries. The code is organized under the `Core/` and `Drivers/` directories.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user