{"id":29026354,"url":"https://github.com/luonghuuphuc/ecg_signal_stm32","last_synced_at":"2025-09-01T06:35:13.973Z","repository":{"id":300005269,"uuid":"1004898328","full_name":"LuongHuuPhuc/ECG_signal_STM32","owner":"LuongHuuPhuc","description":"ECG signal measure using AD8232 sensor and STM32 MCU ","archived":false,"fork":false,"pushed_at":"2025-06-19T10:58:54.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-21T23:40:49.338Z","etag":null,"topics":["ad8232","dma","ecg","stm32","timer"],"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/LuongHuuPhuc.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,"zenodo":null}},"created_at":"2025-06-19T10:54:43.000Z","updated_at":"2025-06-19T11:00:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"97d364f2-1fa1-4f72-a177-6dee8c04d499","html_url":"https://github.com/LuongHuuPhuc/ECG_signal_STM32","commit_stats":null,"previous_names":["luonghuuphuc/ecg_signal_stm32"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/LuongHuuPhuc/ECG_signal_STM32","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuongHuuPhuc%2FECG_signal_STM32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuongHuuPhuc%2FECG_signal_STM32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuongHuuPhuc%2FECG_signal_STM32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuongHuuPhuc%2FECG_signal_STM32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuongHuuPhuc","download_url":"https://codeload.github.com/LuongHuuPhuc/ECG_signal_STM32/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuongHuuPhuc%2FECG_signal_STM32/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273082425,"owners_count":25042282,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ad8232","dma","ecg","stm32","timer"],"created_at":"2025-06-26T05:32:51.335Z","updated_at":"2025-09-01T06:35:12.341Z","avatar_url":"https://github.com/LuongHuuPhuc.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *Đọc tín hiệu ECG bằng AD8232 sử dụng Timer Trigger và DMA* # \n## *1. Cách cấu hình* ##\n- Timer là bộ đếm định kỳ \n- Prescaler là bộ chia tần để điều chỉnh tốc độ đếm \n- Period xác định số tick cần đếm trước khi trigger (Ví dụ để là 49 thì sau 49 tick, nó sẽ trigger 1 lần)\n- TRGO (Trigger Output): Đây là tín hiệu được phát ra từ Timer khi nó được trigger\n- ADC được kích hoạt bẳng TRGO -\u003e Giúp lấy mẫu đều đặn và không phụ thuộc vào CPU \n \n## *2. Hiểu về bản chất của việc Timer Trigger* ## \n* Khoảng thời gian mà Timer Trigger chính là **chu kỳ lấy mẫu (Sample Period)** và nó cũng là **tần số lấy mẫu/tốc độ lấy mẫu (Sampling Frequency/Sampling rate)**\n* Ta không nên sử dụng Delay của hệ thông như HAL_Delay() vì đây là hàm khiến cả hệ thống/chương trình bị ngừng lại và không làm gì cả, khiến cho sai lệch về thời gian thực tế \nvà ảnh hưởng đến việc phân tích QRS của ECG\n* Thế nên để có thể lấy mãu liên tục mà ít bị mất mẫu thì nên dùng DMA + Timer để dữ liệu có thể liên tục được cập nhật mà không cần sự can thiệp của CPU, giúp \ntăng tính đồng bộ hóa \u003cbr\u003e\n\n### *Vậy Timer hoạt động như thế nào ?* ###\nTimer là bộ đếm, nó sẽ đếm từ 0, mỗi lần tăng 1 giá trị, gọi là 1 tick.\n* Tốc độ phụ thuộc vào: *Tần số Clock Timer* và *Prescaler* \n* Timer đếm từ 0 đến giá trị ARR (AutoReload Register) - tức là Counter Period mà đã set trong CubeMX\n* Khi đếm xong (đạt ARR), nó: \n  - Reset về lại 0 \n  - Gây 1 sự kiện \"Update Event\"\n  - Nếu bạn chỉnh cấu hình TRGO = Update Event -\u003e Timer sẽ phát 1 xung trigger tại đây \n  - Chính xung này được gọi là xung Trigger Output (TRGO) -\u003e ADC nhận được và bắt đầu lấy mẫu\n\n# Kết quả # \n![image](https://github.com/user-attachments/assets/edae0199-ae4e-467c-a14f-96ff22cb560f)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluonghuuphuc%2Fecg_signal_stm32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluonghuuphuc%2Fecg_signal_stm32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluonghuuphuc%2Fecg_signal_stm32/lists"}