{"id":18290585,"url":"https://github.com/shuai132/scopemcu","last_synced_at":"2025-04-05T10:30:50.600Z","repository":{"id":47795428,"uuid":"223929153","full_name":"shuai132/ScopeMCU","owner":"shuai132","description":"虚拟示波器 MCU端","archived":false,"fork":false,"pushed_at":"2023-09-25T08:52:44.000Z","size":714,"stargazers_count":102,"open_issues_count":0,"forks_count":27,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-21T02:41:31.745Z","etag":null,"topics":["cubemx","oscilloscope","scope","stm32","stm32f103"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shuai132.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-25T11:08:45.000Z","updated_at":"2025-03-10T01:09:10.000Z","dependencies_parsed_at":"2024-11-05T14:11:46.413Z","dependency_job_id":"65bea1b0-b197-4e92-8527-d90e66db2173","html_url":"https://github.com/shuai132/ScopeMCU","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2FScopeMCU","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2FScopeMCU/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2FScopeMCU/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2FScopeMCU/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shuai132","download_url":"https://codeload.github.com/shuai132/ScopeMCU/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247324374,"owners_count":20920629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cubemx","oscilloscope","scope","stm32","stm32f103"],"created_at":"2024-11-05T14:11:31.161Z","updated_at":"2025-04-05T10:30:45.570Z","avatar_url":"https://github.com/shuai132.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ScopeMCU\n\n[![Build Status](https://github.com/shuai132/ScopeMCU/workflows/build/badge.svg)](https://github.com/shuai132/ScopeMCU/actions?workflow=build)\n\nOscilloscope for MCU\n\nMCU: STM32F103C8Tx\n\n需配合[ScopeGUI](https://github.com/shuai132/ScopeGUI)使用\n\n[截图说明见wiki](https://github.com/shuai132/ScopeGUI/wiki)\n\n[最新版Releases](https://github.com/shuai132/ScopeMCU/releases)\n\n## Introduction\n\n用最少的硬件成本，做一个实用的虚拟示波器。\n\n这是硬件部分，基于STM32最小系统，不使用任何片外外设。\n可以方便地移植到其他硬件（只需要ADC、定时器、串口/USB即可）。\n采样率和采样深度等参数取决于芯片性能。\n\n## Features\n\n* Timer触发ADC+DMA 精确采样\n* ADC数值已校准（使用内部基准电压）\n* 采样率无级可调 最高采样率1Msps\n* 采样深度可调 当前6144(1024*6)点\n* 内置自测信号（1kHz方波）\n* 多种触发方式（自动、正常、单次）\n* FFT频谱分析（上位机实现）\n* USB CDC 高速数据传输\n\n注: \n* 未设计前端运放电路，只用于采集0~3.3V信号。\n* 为了采样精度和校准，当前最高采样率: 70ksps\n\n## IO Map\n\n### 必需\n\n| 管脚 | 作用 |\n| :---- | :---- |\nPA0  | ADC通道\nPA11 | USB DM   USB接口\nPA12 | USB DP   USB接口\n\n### 可选\n\n| 管脚 | 作用 |\n| :---- | :---- |\nPC13 | LED指示灯 采样过程为低电平\nPA8  | 1kHz方波信号 用于自测\nPA9  | USART1 TX 调试串口\nPA10 | USART1 RX 调试串口\n\n## 移植\n\n\n设计上把可移植性作为重要目标，可以很方便地移植到其他单片机、Arduino、DSP等硬件。\n\n只需硬件提供指定功能实现函数即可，具体见[ScopeCore](https://github.com/shuai132/ScopeCore)中public方法的注释或移植步骤。\n\n注: \n* 需要C++11支持，推荐使用arm-none-eabi编译器和cmake构建，已在Windows、macOS、Ubuntu下测试通过。\n* 为了方便软件设计和数据解析，直接打包结构体作为消息单元。注意要和上位机保持一致的字节序（arm、x86、arduino均为小端模式）。\n\n### 移植步骤\n\n* 初始化scope\n```cpp\n    // 在全局初始化\n    static const size_t MaxSn = 1024 * 6;   // 取决于RAM大小\n    static uint8_t Buffer[Message::CalcBytes(MaxSn)];\n    static ScopeMCU scopeMcu(MaxSn, Buffer);\n    ...\n\n    scopeMcu.setVolLimits(0, 3300);\n    scopeMcu.setFsLimits(1, 10000);\n    scopeMcu.setMcuImpl(\n            {\n                    .sendData = [](uint8_t* data, size_t size) {\n                        // 用串口发送数据\n                    },\n                    .startADC = []{\n                        // 开始采样\n                    },\n                    .stopADC = []{\n                        // 停止采样\n                    },\n                    .setSampleFs = [](uint32_t fs) {\n                        // 设置采样率 返回实际的采样率\n                    },\n                    .onSampling = [](bool sampling) {\n                        // 可用来控制指示灯状态\n                    },\n            });\n```\n* 当收到串口数据\n```cpp\n    scopeMcu.onRead(data, size);\n```\n* 当一次ADC转换完成  \n```cpp\n    scopeMcu.onADC(vol);\n```\n注：\n* `startADC`之前不要触发`onADC`\n\n## DevelopTools\n\n* STM32CubeMX\n* arm-none-eabi-gcc\n* CLion(CMake)\n* OpenOCD\n* ST-LINK\n\n## Install Requirements(for macOS)\n\n* config OpenOCD and ST-LINK\n```bash\nbrew install openocd\nbrew install stlink\nbrew cask install gcc-arm-embedded\n```\n\n## Usage\n* [blog](https://blog.csdn.net/u012456479/article/details/101543344)\n\n## Links\n\n* [arm-none-eabi-gcc](https://developer.arm.com/tools-and-software/open-source-software)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuai132%2Fscopemcu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuai132%2Fscopemcu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuai132%2Fscopemcu/lists"}