{"id":15527786,"url":"https://github.com/zpg6/mcp2003a","last_synced_at":"2026-02-03T01:01:26.661Z","repository":{"id":245727433,"uuid":"819058841","full_name":"zpg6/mcp2003a","owner":"zpg6","description":"Embedded Rust driver for LIN Bus communications with Microchip MCP2003A LIN Transceiver","archived":false,"fork":false,"pushed_at":"2024-12-07T22:10:31.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T23:41:12.751Z","etag":null,"topics":["automotive","esp-rs","linbus","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/mcp2003a","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zpg6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-06-23T16:55:10.000Z","updated_at":"2024-12-07T22:10:34.000Z","dependencies_parsed_at":"2024-11-03T18:21:11.059Z","dependency_job_id":"997d98ee-a9ff-4b05-b46d-7fed7ad00f37","html_url":"https://github.com/zpg6/mcp2003a","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"0602fa230bb52ea6a415a196221b057ec3ffd78a"},"previous_names":["zpg6/mcp2003a"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpg6%2Fmcp2003a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpg6%2Fmcp2003a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpg6%2Fmcp2003a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zpg6%2Fmcp2003a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zpg6","download_url":"https://codeload.github.com/zpg6/mcp2003a/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250433464,"owners_count":21429879,"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":["automotive","esp-rs","linbus","rust"],"created_at":"2024-10-02T11:09:07.282Z","updated_at":"2026-02-03T01:01:26.592Z","avatar_url":"https://github.com/zpg6.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mcp2003a\n\nEmbedded Rust Microchip MCP2003A/B LIN transceiver driver with `embedded-hal` blocking and async traits for `no-std` environments.\n\n\u003ca href=\"https://crates.io/crates/mcp2003a\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/mcp2003a.svg\" alt=\"Crates.io\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://docs.rs/mcp2003a\"\u003e\n    \u003cimg src=\"https://docs.rs/mcp2003a/badge.svg\" alt=\"Documentation\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/zpg6/mcp2003a\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/github-zpg6/mcp2003a-black\" alt=\"GitHub Repo\"\u003e\n\u003c/a\u003e\n\u003cbr\u003e\u003cbr\u003e\n\n\u003e [!WARNING]\n\u003e This crate may not be suitable for production use. It was written as hands-on learning exercise of a well-documented specification.\n\u003e It may not cover all edge cases or vendor-specific implementations. Please use with caution.\n\nThis driver attempts to be a simple reflection of the well-documented instructions from the LIN specification:\nhttps://www.lin-cia.org/fileadmin/microsites/lin-cia.org/resources/documents/LIN_2.2A.pdf\n\n## Alternatives\n\n- [https://github.com/Skuzee/LIN_BUS_lib-Skuzee](https://github.com/Skuzee/LIN_BUS_lib-Skuzee) (Arduino)\n- [https://github.com/NaokiS28/LINduino](https://github.com/NaokiS28/LINduino) - (Arduino)\n- [https://github.com/Sensirion/lin-bus-rs](https://github.com/Sensirion/lin-bus-rs) - (Rust)\n- [https://github.com/fernpedro/Two-node-LIN-cluster-with-Arduino](https://github.com/fernpedro/Two-node-LIN-cluster-with-Arduino) - (Arduino)\n  - Includes wiring diagram, walkthrough, and photo of a LIN frame on an oscilloscope\n- [https://forum.arduino.cc/t/sending-data-using-lin-cominication/1178509](https://forum.arduino.cc/t/sending-data-using-lin-cominication/1178509) - (Arduino) (forum post with example code)\n- [https://github.com/gandrewstone/LIN](https://github.com/gandrewstone/LIN) - (C++)\n- [https://github.com/fernpedro/LIN-frame-Header-implementation](https://github.com/fernpedro/LIN-frame-Header-implementation) - (C++)\n\n## Similar Projects\n\n- [https://github.com/matt2005/LIN-1](https://github.com/matt2005/LIN-1) - (C++) Supports LIN on MCP2025\n- [https://github.com/macchina/LIN](https://github.com/macchina/LIN) - (C++) (Arduino library to add dual LIN support on SAM3X based boards with a TJA1021/TJA1027 transceiver)\n\n## Supported MCP2003 Part Numbers\n\nTested on:\n\n- [MCP2003A](https://www.microchip.com/wwwproducts/en/MCP2003A) (No Longer Recommended for New Designs)\n- MCP2003E\n\nShould also work with:\n\n- [MCP2003B](https://www.microchip.com/en-us/product/MCP2003B) (functional drop-in replacement for MCP2003A)\n\n## References\n\n- [MCP2003A Product Page](https://www.microchip.com/wwwproducts/en/MCP2003A)\n- [MCP2003/4/3A/4A Datasheet](https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/DataSheets/20002230G.pdf)\n- [MCP2003A to MCP2003B Migration Guide](https://ww1.microchip.com/downloads/en/DeviceDoc/90003150A.pdf)\n- [MCP2003B Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/2000546C3.pdf)\n\nFull Documentation: [https://docs.rs/mcp2003a/latest/mcp2003a/](https://docs.rs/mcp2003a/latest/mcp2003a/)\n\n## Features\n\nBlocking:\n\n- `embedded-hal = \"1.0.0\"` - Embedded HAL traits for GPIO, UART, and Delay drivers.\n- `embedded-hal-nb = \"1.0.0\"` - Additional non-blocking traits using `nb` crate underneath.\n\nAsync:\n\n- `embedded-hal-async = \"1.0.0\"` - Async traits for async GPIO, and Delay drivers.\n- `embedded-io-async = \"0.6.1\"` - Async traits for async UART drivers.\n\n## Usage\n\nAdd the crate to your `Cargo.toml`:\n\n```\ncargo add mcp2003a\n```\n\n### Examples\n\n```rust\nlet mut mcp2003a = Mcp2003a::new(uart2_driver, break_pin_driver, delay);\n\nlet lin_bus_config = LinBusConfig {\n   speed: LinBusSpeed::Baud19200,\n   break_duration: LinBreakDuration::Minimum13Bits, // Test for your application\n   wakeup_duration: LinWakeupDuration::Minimum250Microseconds, // Test for your application\n   read_device_response_timeout: LinReadDeviceResponseTimeout::DelayMilliseconds(15), // Test for your application\n   inter_frame_space: LinInterFrameSpace::DelayMilliseconds(1), // Test for your application\n};\nmcp2003a.init(lin_bus_config);\n\nmcp2003a.send_wakeup();\n\n// Works for different LIN versions, you calculate id and checksum based on your application\nmcp2003a.send_frame(0x01, \u0026[0x02, 0x03], 0x05).unwrap();\n\nlet mut read_buffer = [0u8; 8]; // Initialize the buffer to the frame's known size\nlet checksum = mcp2003a.read_frame(0xC1, \u0026mut read_buffer).unwrap();\n```\n\nIf you have async UART, GPIO, and Delay drivers that implement the `embedded-hal-async` traits, you can use the async methods (recommended). For example:\n\n```rust\nmcp2003a.send_frame_async(0x01, \u0026[0x02, 0x03], 0x05).await.unwrap();\n```\n\n### Full Examples\n\n(More coming soon)\n\n- [ESP-32 via ESP-RS](https://github.com/zpg6/mcp2003a/tree/main/examples/mcp2003a-esp-rs) - Example using the MCP2003A with an ESP-32 microcontroller using `esp-idf-hal` (std).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpg6%2Fmcp2003a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzpg6%2Fmcp2003a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzpg6%2Fmcp2003a/lists"}