用于嵌入式设备的良好串行通信协议/堆栈? [英] A good serial communications protocol/stack for embedded devices?

查看:23
本文介绍了用于嵌入式设备的良好串行通信协议/堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为各种项目编写了几种不同的自定义串行协议之后,我开始对每次都重新发明轮子感到沮丧.代替继续为每个项目开发定制解决方案,我一直在寻找更通用的解决方案.我想知道是否有人知道满足以下要求的串行协议(或更好的实现):

After writing several different custom serial protocols for various projects, I've started to become frustrated with re-inventing the wheel every time. In lieu of continuing to develop custom solutions for every project, I've been searching for a more general solution. I was wondering if anyone knows of a serial protocol (or better yet, implementation) that meets the following requirements:

  • 支持多种设备.我们希望能够支持 RS485 总线.
  • 保证送达.某种确认机制,以及一些简单的错误检测(CRC16 可能没问题).
  • 不是主/从.理想情况下,从站将能够异步发送数据.这主要是出于审美原因,轮询每个奴隶的概念对我来说并不合适.
  • 操作系统独立性.理想情况下,它根本不会依赖抢占式多任务环境.如果我能得到其他东西,我愿意承认这一点.
  • ANSI C.我们需要能够为几种不同的架构编译它.

速度不是什么大问题,我们愿意放弃一些速度来满足其他一些需求.但是,我们希望尽量减少所需资源的数量.

Speed isn't too much of an issue, we're willing to give up some speed in order to meet some of those other needs. We would, however, like to minimize the amount of required resources.

我即将开始实现一个带有背负式 ACK 且没有选择性重复的滑动窗口协议,但我想也许有人可以为我省去麻烦.有谁知道我可以利用的现有项目?或者也许是更好的策略?

I'm about to start implementing a sliding window protocol with piggybacked ACKs and without selective repeat, but thought that perhaps someone could save me the trouble. Does anyone know of an existing project that I could leverage? Or perhaps a better strategy?

更新
我认真考虑过 TCP/IP 实现,但真的希望有更轻量级的东西.TCP/IP 的许多功能对于我正在尝试做的事情来说太过分了.我愿意(不情愿地)接受,也许我想要的功能没有包含在更轻的协议中.

UPDATE
I have seriously considered a TCP/IP implementation, but was really hoping for something more lightweight. Many of the features of TCP/IP are overkill for what I'm trying to do. I'm willing to accept (begrudgingly) that perhaps the features I want just aren't included in lighter protocols.

更新 2
感谢您提供有关 CAN 的提示.我过去看过它,将来可能会使用它.不过,我真的希望该库能够处理确认、缓冲、重试等.我想我更多的是寻找网络/传输层而不是数据链路/物理层.

UPDATE 2
Thanks for the tips on CAN. I have looked at it in the past and will probably use it in the future. I'd really like the library to handle the acknowledgements, buffering, retries etc, though. I guess I'm more looking for a network/transport layer instead of a datalink/physical layer.

更新 3
所以听起来这个领域的最新技术是:

UPDATE 3
So it sounds like the state of the art in this area is:

  • 精简的 TCP/IP 堆栈.可能从 lwIPuIP.
  • 基于 CAN 的实现,它可能会严重依赖 CAN 总线,因此在其他物理层上没有用处.CAN Festival 之类的东西可能会有所帮助.
  • HDLC 或 SDLC 实现(如 this one).这大概就是我们要走的路.
  • A trimmed down TCP/IP stack. Probably starting with something like lwIP or uIP.
  • A CAN based implementation, it would probably rely heavily on the CAN bus, so it wouldn't be useful on other physical layers. Something like CAN Festival could help along the way.
  • An HDLC or SDLC implementation (like this one). This is probably the route we'll take.

如果您遇到此问题,请随时发布更多答案.

Please feel free to post more answers if you come across this question.

推荐答案

你考虑过HDLCSDLC?

还有 LAP/D(链接访问协议,D-Channel).

There's also LAP/D (Link Access Protocol, D-Channel).

Uyless Black 的数据链路协议"是总是在我的书架上——你也可以在那里找到一些有用的材料(甚至仔细阅读 TOC 并研究不同的协议)

Uyless Black's "Data Link Protocols" is always nearby on my bookshelf - you might find some useful material in there too (even peruse the TOC & research the different protocols)

这篇关于用于嵌入式设备的良好串行通信协议/堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆