
ats_by_ai_2502
ats firmware by claude 3.5 sonnet
Repository Info
About This Server
ats firmware by claude 3.5 sonnet
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
ATS2411 自动测试系统
基于STM32F103的自动测试系统,支持多通道电压采集和负载控制。
硬件配置
主控制器
- MCU: STM32F103CB (BluePill)
- 时钟: 72MHz
- Flash: 128KB
- RAM: 20KB
外设配置
-
ADC (MCP3201)
- 接口:SPI2
- 引脚:
- CS: PA4
- MOSI: PA7
- MISO: PA6
- SCK: PA5
-
负载控制 (TCA6424A)
- 接口:I2C1
- 地址:0x22
- 引脚:
- SCL: PB6
- SDA: PB7
- RST: PB3
-
驱动控制 (TCA6424A)
- 接口:I2C1
- 地址:0x23
- 引脚:同上
-
网络接口 (W5500)
- 接口:SPI1
- 引脚:
- CS: PB12
- RST: PA12
- MOSI: PB15
- MISO: PB14
- SCK: PB13
-
温度传感器 (DS18B20)
- 接口:单总线
- 引脚:PA10
通道配置
- 20个测试通道
- 3种负载阻值:
- 22.5Ω (通道0-4, 15-19)
- 20.0Ω (通道5-9)
- 18.5Ω (通道10-14)
软件功能
采样功能
- 采样率:10kHz
- 采样点数:1000-10000可配置
- ADC分辨率:12位
SCPI命令集
-
*IDN?- 功能:获取设备标识信息
- 返回格式:"ATS2411,Version 2.4.11,STM32F103CB"
-
MEASure <channel>[,<points>]- 功能:测量指定通道的电压
- 参数:
- channel:通道号(0-19)
- points:采样点数(1000-10000,可选)
- 返回:测量结果(单位:ADC码值)
-
MEASure:TEMPerature- 功能:测量当前温度
- 返回:温度值(单位:摄氏度)
-
SYSTem:CHANnel?- 功能:查询通道配置信息
- 返回:通道数量和配置
-
SYSTem:SAMPle?- 功能:查询采样配置信息
- 返回:采样率、点数范围等
-
SYSTem:STATus?- 功能:查询系统状态
- 返回:各个模块的工作状态
-
CALibration:STARt- 功能:启动校准过程
- 校准流程:
- 断开所有负载
- 采集基准电压
- 存储校准系数到EEPROM
- 超时时间:30秒
- 返回:"CALIBRATION_OK"或错误代码
通信协议
请求示例
{
"cmd": "MEASure:VOLT? 5,1000",
"seq": 12345
}
响应示例
{
"status": 0,
"data": [512,515,...,508],
"crc16": 0xA3D5
}
测量流程
- 选择测试通道
- 根据通道自动配置对应的负载阻值
- 开启驱动(延迟10ms)
- 进行采样
- 关闭驱动(提前10ms)
- 恢复所有控制信号到默认状态
安全特性
- 驱动和负载互锁:同时只能开启一个驱动和一个负载
- 采样保护:驱动开启前后有延时保护
- 错误处理:任何错误发生时自动恢复到安全状态
- 上电初始化:确保所有控制信号处于安全状态
校准流程
graph TD
A[开始校准] --> B[断开所有负载]
B -->|调用CAL_Reset| C[采集基准电压]
C --> D{电压稳定?}
D -- 是 --> E[计算校准系数]
D -- 否 --> F[报错0xE4]
E -->|调用CAL_Write| G[写入EEPROM]
G -->|调用CAL_Validate| H[验证校验和]
H --> I[返回CALIBRATION_OK]
开发环境
- 平台:PlatformIO
- 框架:Arduino
- 依赖库:
- STM32duino FreeRTOS
- Ethernet2
- OneWire
- DallasTemperature
- MCP_ADC
- MCP4725
- I2Cdevlib-Core
- I2Cdevlib-TCA6424A
- Vrekrer SCPI parser
platformio.ini配置
[env:bluepill_f103cb]
platform = ststm32
board = bluepill_f103cb
framework = arduino
lib_deps =
stm32duino/STM32FreeRTOS @ 10.2.0
adafruit/Adafruit MCP4725 @ 2.0.0
i2cdevlib/I2Cdev @ 1.0.0
编译烧录
pio run -t upload
故障代码
| 代码 | 助记符 | 描述 | 相关函数 |
|---|---|---|---|
| 0xE1 | ERR_CHANNEL | 通道号超出范围 | validateChannel |
| 0xE2 | ERR_LOAD_STATE | 负载/驱动互锁冲突 | checkLoadState |
| 0xE3 | ERR_ADC_TIMEOUT | SPI通信超时 | readADC |
| 0xE4 | ERR_CALIBRATION | 校准数据校验失败 | CAL_Validate |
注意事项
- 首次上电时,确保所有外设连接正确
- 测量时注意遵循正确的通道选择顺序
- 避免频繁切换负载,以延长继电器寿命
- 定期检查温度,避免系统过热
Quick Start
Clone the repository
git clone https://github.com/tigerfan/ats_by_ai_2502Install dependencies
cd ats_by_ai_2502
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.