fix: correct LED B color from blue to red for PM3 Easy
Some checks failed
Build Base Image (Stages 0-2) / build-base (push) Has been cancelled

LED B on PM3 Easy is red per firmware define LED_RED=LED_B, not blue.
Updated all examples to use color names (green, red, orange, red2).
Added tune LED visualization examples and updated code references.

Tune LED color mappings inspired by the Dangerous Things RFID
diagnostic card color scheme:
- LF tune: Green (PM3 Easy) / Red2 (RDV4)
- HF tune: Red (PM3 Easy) / Orange (RDV4)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
michael
2026-03-15 20:15:49 -07:00
parent daad47933c
commit 5b9790c901

View File

@@ -8,12 +8,12 @@ Based on hardware testing with Proxmark3 Easy and `LED_ORDER=PM3EASY`:
| LED | Color | GPIO Pin | PWM Channel | Brightness | Effects | Physical Position | | LED | Color | GPIO Pin | PWM Channel | Brightness | Effects | Physical Position |
|-----|--------|----------|-------------|------------|---------|-------------------| |-----|--------|----------|-------------|------------|---------|-------------------|
| A | Green | PA0 | PWM0 | 0-100% | All | 1st (leftmost) | | A | Green | PA0 | PWM0 | 0-100% | All | 1st (leftmost) |
| B | Blue | PA2 | PWM2 | 0-100% | All | 4th (rightmost) | | B | Red | PA2 | PWM2 | 0-100% | All | 4th (rightmost) |
| C | Orange | PA9 | None | On/Off | Blink | 2nd | | C | Orange | PA9 | None | On/Off | Blink | 2nd |
| D | Red | PA8 | None | On/Off | Blink | 3rd | | D | Red2 | PA8 | None | On/Off | Blink | 3rd |
**Physical LED order (left to right):** Green, Orange, Red, Blue **Physical LED order (left to right):** Green, Orange, Red2, Red
### GPIO Pin Details ### GPIO Pin Details
@@ -21,9 +21,20 @@ From `include/config_gpio.h` with `LED_ORDER_PM3EASY`:
```c ```c
#define GPIO_LED_A AT91C_PIO_PA0 // Green - PWM0 capable #define GPIO_LED_A AT91C_PIO_PA0 // Green - PWM0 capable
#define GPIO_LED_B AT91C_PIO_PA2 // Blue - PWM2 capable #define GPIO_LED_B AT91C_PIO_PA2 // Red - PWM2 capable
#define GPIO_LED_C AT91C_PIO_PA9 // Orange - GPIO only #define GPIO_LED_C AT91C_PIO_PA9 // Orange - GPIO only
#define GPIO_LED_D AT91C_PIO_PA8 // Red - GPIO only #define GPIO_LED_D AT91C_PIO_PA8 // Red2 - GPIO only
```
### Firmware Color Defines
From `armsrc/util.h` with `LED_ORDER_PM3EASY`:
```c
#define LED_GREEN LED_A // PA0 - PWM capable
#define LED_RED LED_B // PA2 - PWM capable
#define LED_ORANGE LED_C // PA9 - GPIO only
#define LED_RED2 LED_D // PA8 - GPIO only
``` ```
### LED Bitmask Values ### LED Bitmask Values
@@ -42,10 +53,10 @@ With default LED ordering (no `LED_ORDER_PM3EASY`):
| LED | Color | GPIO Pin | PWM Channel | Brightness | Effects | | LED | Color | GPIO Pin | PWM Channel | Brightness | Effects |
|-----|---------|----------|-------------|------------|---------| |-----|---------|----------|-------------|------------|---------|
| A | Orange | PA0 | PWM0 | 0-100% | All | | A | Orange | PA0 | PWM0 | 0-100% | All |
| B | Green | PA8 | None | On/Off | Blink | | B | Green | PA8 | None | On/Off | Blink |
| C | Red | PA9 | None | On/Off | Blink | | C | Red | PA9 | None | On/Off | Blink |
| D | Red2 | PA2 | PWM2 | 0-100% | All | | D | Red2 | PA2 | PWM2 | 0-100% | All |
**Note:** Only LEDs on PA0 and PA2 can use PWM brightness control and PWM effects (pulse, fade) on any PM3 variant. **Note:** Only LEDs on PA0 and PA2 can use PWM brightness control and PWM effects (pulse, fade) on any PM3 variant.
@@ -54,19 +65,23 @@ With default LED ordering (no `LED_ORDER_PM3EASY`):
### Basic LED Control ### Basic LED Control
```bash ```bash
# Green LED at 50% brightness # Green LED at 50% brightness (or --led g)
hw led --led a --brightness 50 hw led --led green --brightness 50
# Blue LED at 75% brightness # Red LED at 75% brightness (or --led r)
hw led --led b --brightness 75 hw led --led red --brightness 75
# Orange LED on (no brightness control) # Orange LED on (no brightness control, or --led o)
hw led --led c --on hw led --led orange --on
# Red LED toggle # Red2 LED toggle
hw led --led d --toggle hw led --led red2 --toggle
# Both PWM LEDs at 30% # Both PWM LEDs at 30%
hw led --led green,red --brightness 30
# Letter names also work
hw led --led a --on
hw led --led a,b --brightness 30 hw led --led a,b --brightness 30
``` ```
@@ -75,24 +90,24 @@ hw led --led a,b --brightness 30
Three effects are available: **pulse**, **fade**, and **blink**. Three effects are available: **pulse**, **fade**, and **blink**.
```bash ```bash
# Pulse effect (PWM LEDs only: A, B) # Pulse effect (PWM LEDs only: green, red)
# Smoothly fades in and out # Smoothly fades in and out
hw led --led a --pulse # 5 cycles @ 500ms default hw led --led green --pulse # 5 cycles @ 500ms default
hw led --led a,b --pulse --count 10 # 10 cycles hw led --led green --pulse --count 10 # 10 cycles
hw led --led a --pulse --speed 300 # Faster pulse (300ms cycle) hw led --led green --pulse --speed 300 # Faster pulse (300ms cycle)
hw led --led b --pulse --count 0 # Infinite until button press hw led --led red --pulse --count 0 # Infinite until button press
# Fade effect (PWM LEDs only: A, B) # Fade effect (PWM LEDs only: green, red)
# Starts at full brightness, fades to off # Starts at full brightness, fades to off
hw led --led a --fade # Default 500ms fade hw led --led green --fade # Default 500ms fade
hw led --led a,b --fade --speed 1000 # Slower 1-second fade hw led --led red --fade --speed 1000 # Slower 1-second fade
# Blink effect (ALL LEDs supported: A, B, C, D) # Blink effect (ALL LEDs supported)
# Alternates on/off # Alternates on/off
hw led --led a,b,c,d --blink # All LEDs, 5 blinks hw led --led all --blink # All LEDs, 5 blinks
hw led --led c,d --blink --count 20 # Non-PWM LEDs work too hw led --led orange,red2 --blink --count 20 # Non-PWM LEDs work too
hw led --led all --blink --speed 200 # Fast blink (200ms cycle) hw led --led all --blink --speed 200 # Fast blink (200ms cycle)
hw led --led a --blink --count 0 # Infinite until stopped hw led --led green --blink --count 0 # Infinite until stopped
``` ```
### Effect Parameters ### Effect Parameters
@@ -104,7 +119,18 @@ hw led --led a --blink --count 0 # Infinite until stopped
**Note:** `--count 0` runs the effect indefinitely until interrupted by: **Note:** `--count 0` runs the effect indefinitely until interrupted by:
- Pressing the button on the Proxmark3 device - Pressing the button on the Proxmark3 device
- Sending any other command
### Tune LED Visualization
LED brightness tracks antenna voltage in real-time during tuning:
```bash
# LF tune with green LED tracking voltage
lf tune --led
# HF tune with red LED tracking voltage
hf tune --led
```
### Multi-Device Identification ### Multi-Device Identification
@@ -112,13 +138,13 @@ Use brightness levels and effects to distinguish between multiple Proxmark3 devi
```bash ```bash
# Device 1: Dim green # Device 1: Dim green
hw led --led a --brightness 20 hw led --led green --brightness 20
# Device 2: Bright blue # Device 2: Bright red
hw led --led b --brightness 100 hw led --led red --brightness 100
# Device 3: Pulsing green (easy to spot) # Device 3: Pulsing green (easy to spot)
hw led --led a --pulse --count 0 hw led --led green --pulse --count 0
# Device 4: Fast blinking all LEDs # Device 4: Fast blinking all LEDs
hw led --led all --blink --speed 200 --count 0 hw led --led all --blink --speed 200 --count 0
@@ -127,19 +153,21 @@ hw led --led all --blink --speed 200 --count 0
## Hardware Testing Notes ## Hardware Testing Notes
- Confirmed via individual LED testing on PM3 Easy hardware - Confirmed via individual LED testing on PM3 Easy hardware
- During `hw tune`: Red (D) and Blue (B) LEDs typically active - During `hw tune`: Red (B) and Red2 (D) LEDs typically active
- During flashing: Orange (C) and sometimes Green (A) visible - During flashing: Orange (C) and sometimes Green (A) visible
- LED polarity: Active-low (PWM duty cycle is inverted) - PWM polarity: AT91 PWM with CPOL=0 outputs LOW during duty portion, so duty cycle is inverted to achieve correct brightness
## Code References ## Code References
- LED definitions: [armsrc/util.h](/.pm3-test/proxmark3/armsrc/util.h) lines 45-63 - LED definitions: `armsrc/util.h` lines 45-63
- LED macros: [include/proxmark3_arm.h](/.pm3-test/proxmark3/include/proxmark3_arm.h) lines 91-102 - LED macros: `include/proxmark3_arm.h` lines 91-102
- GPIO mapping: [include/config_gpio.h](/.pm3-test/proxmark3/include/config_gpio.h) lines 22-39 - GPIO mapping: `include/config_gpio.h` lines 22-39
- PWM functions: [armsrc/util.c](/.pm3-test/proxmark3/armsrc/util.c) lines 419-504 - PWM functions: `armsrc/util.c`
- LED control command: `client/src/cmdhw.c` (CmdHWLed)
- Tune LED integration: `armsrc/appmain.c` (CMD_MEASURE_ANTENNA_TUNING_HF/LF handlers)
--- ---
**Last Updated:** 2026-01-06 **Last Updated:** 2026-03-15
**Hardware:** Proxmark3 Easy with LED_ORDER=PM3EASY **Hardware:** Proxmark3 Easy with LED_ORDER=PM3EASY
**Effects Added:** pulse, fade, blink (v1.1) **Features:** brightness control, pulse, fade, blink, tune LED visualization