Files
TX/CLAUDE.md

108 lines
3.5 KiB
Markdown
Raw Normal View History

2025-08-26 16:10:47 -05:00
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is an embedded C application for the LPC54114 microcontroller (ARM Cortex-M4) running on the LPCXpresso54114 development board. The project appears to be a transmitter device (TX) with signal generation, display, USB communication, and power management capabilities.
**Hardware Target:** NXP LPC54114 dual-core Cortex-M4/M0+ microcontroller
**Software Version:** 1.10A (defined in source/System/system.h:18)
## Build System
### Build Commands
```bash
# Build debug version
cd Debug
make all
# Build release version
cd Release
make all
# Clean build artifacts
make clean
```
### Build Artifacts
- **Target executable:** `TX_App.axf` (ARM executable format)
- **Binary output:** `TX_App.bin` (generated post-build)
- **Memory map:** `TX_App.map`
- **Linker scripts:** `TX_App_Debug.ld`, `TX_App_Release.ld`
### Toolchain
- **Compiler:** arm-none-eabi-gcc
- **Target:** Cortex-M4 with hardware floating point (fpv4-sp-d16)
- **IDE Support:** MCUXpresso, IAR, Keil MDK
## Code Architecture
### Core System Structure
**Main Application Flow:**
- Entry point: `source/main.c`
- System initialization: `source/System/system.c`
- Hardware initialization: `source/init.c`
**Key Subsystems:**
1. **Signal Generation (`source/dds.c`, `source/fgen.c`)**
- DDS (Direct Digital Synthesis) for frequency generation
- Function generator capabilities
- Frequency range: 3.14kHz - 200kHz for broadcast mode
- System clock: 12MHz
2. **Display System (`source/display.c`, `source/lcd.c`)**
- Graphics library in `source/Graphics/`
- Font rendering system in `source/Fonts/`
- Multi-language support with translations
- Icon and bitmap handling
3. **Power Management (`source/battery.c`, `source/ports.c`)**
- Battery type detection (Lithium/Alkaline/External DC)
- Power limits: 10W (Lithium/Ext), 5W (Alkaline)
- Clamp control and regulation
4. **Communication (`source/USB/`, `source/broadcast.c`)**
- USB CDC (Virtual COM) interface
- Broadcast transmission capabilities
- Flash update support via USB
5. **Hardware Drivers (`source/driver.c`, `source/io.c`)**
- SPI communication for external components
- ADC for measurements
- Timer and PWM control
- GPIO port management
### Directory Structure
- `source/` - Main application code
- `source/System/` - System-level configuration and data structures
- `source/USB/` - USB device implementation
- `source/Graphics/` - Display graphics and UI
- `source/Fonts/` - Font data and localization
- `source/Loader/` - Bootloader and flash update functionality
- `drivers/` - NXP SDK peripheral drivers
- `CMSIS/` - ARM CMSIS headers
- `usb/` - USB middleware stack
- `Debug/`, `Release/` - Build output directories
### Key Data Structures
**ClampData_t** (`source/System/system.h:35`): Core control structure containing:
- Slope, voltage, current, impedance measurements
- Power regulation parameters
- Digital potentiometer settings
### Development Notes
- The project uses NXP's MCUXpresso SDK for peripheral drivers
- Hardware-specific fixes are isolated in `source/hwFixes.c`
- Comprehensive change log maintained in `source/AppChangeLog.txt`
- Flash memory layout: Application starts at 0x10000 (64KB offset for bootloader)
- Maximum application size: 192KB
### Testing
Connect via USB (J7 connector) at 115200 baud for debug console output. The application supports firmware updates through the bootloader system.