Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #25406
| From | Chris <xxx.syseng.yyy@gfsys.co.uk> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Do you use serialization formats for communication? |
| Date | 2016-11-06 14:49 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <nvnfue$1f1l$1@gioia.aioe.org> (permalink) |
| References | <nu8rm7$4ka$1@dont-email.me> |
On 10/19/16 22:22, pozz wrote: > I often have the need to exchange some data between two or more MCUs. I > usually use I2C or UART as physical layers. > > Normally I design a simple protocol between the MCUs: one framing > mechanism (Start Of Frame, End Of Frame), one integrity check mechanism > (CRC), and so on. > > The payload is statically defined between the two MCUs: > - first byte is the version > - second byte is the voltage monitoring level > - third and fourt bytes are some flags > - ... and so on > > As you can understand, both MCUs *must* know and agree about that > protocol format. However during the lifetime of the product, I need to > add some functionality or fix some bugs and those activites can lead to > a review of the protocol format (maybe i need two bytes for the voltage > level). Sometime, the two MCUs have a different version with a different > protocol format implementation. In order to avoid protocol > incompatibility, they all knows about the protocol formats used before, > so they can adapt the parsing function to the real current protocol format. > As you can understand, it could be a trouble. > > So I'm thinking to use a "self-descriptive" serializer protocol format, > such as Protobuf, Message Pack, BSON and so on. > > Do you use one serialization format? Which one? > > Of course, it should be simple to implement (in transmission/encoding > and reception/decoding) in a small embedded MCU in C language, without > dynamic memory support. I'm not sure you need a complex format here, if you think of the problem in two layers, keeping the protocol layer transparent to data. A simple frame format could be: Start of frame byte Data length, N Data, N bytes Checksum or crc End frame byte You then write a simple state machine to verify checksum, extract the data and its length. Pass that to the protocol layer, which knows where to where to look in the data for it's revision level. To maintain compatability, any new parameters are tagged on to the end of the existing data and the data length increased to suit. Either that, or negotiation between ends to agree capabilities, but that's much more complex and you should be able to avoid it... Regards, Chris
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-20 00:22 +0200
Re: Do you use serialization formats for communication? Dimiter_Popoff <dp@tgi-sci.com> - 2016-10-20 01:30 +0300
Re: Do you use serialization formats for communication? Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2016-10-19 23:23 +0000
Re: Do you use serialization formats for communication? Don Y <blockedofcourse@foo.invalid> - 2016-10-19 16:35 -0700
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-20 09:40 +0200
Re: Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-20 13:52 +0200
Re: Do you use serialization formats for communication? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2016-10-20 15:58 +0300
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-20 15:45 +0200
Re: Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-20 18:06 +0200
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-20 23:39 +0200
Re: Do you use serialization formats for communication? George Neuner <gneuner2@comcast.net> - 2016-10-20 21:01 -0400
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-21 08:56 +0200
Re: Do you use serialization formats for communication? George Neuner <gneuner2@comcast.net> - 2016-10-23 07:05 -0400
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-23 18:23 +0200
Re: Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-21 13:04 +0200
Re: Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-23 16:07 +0200
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-10-23 18:33 +0200
Re: Do you use serialization formats for communication? kalvin.news@gmail.com - 2016-11-02 02:14 -0700
Re: Do you use serialization formats for communication? David Brown <david.brown@hesbynett.no> - 2016-11-02 11:17 +0100
Re: Do you use serialization formats for communication? kalvin.news@gmail.com - 2016-10-20 03:30 -0700
Re: Do you use serialization formats for communication? pozz <pozzugno@gmail.com> - 2016-10-20 23:18 +0200
Re: Do you use serialization formats for communication? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2016-11-06 14:49 +0000
Re: Do you use serialization formats for communication? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2016-11-06 14:58 +0000
Re: Do you use serialization formats for communication? Vincent vB <embedded@spam.com> - 2016-11-11 09:37 +0100
Re: Do you use serialization formats for communication? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2016-11-11 12:25 +0000
Re: Do you use serialization formats for communication? Tim Wescott <seemywebsite@myfooter.really> - 2016-11-11 13:14 -0600
Re: Do you use serialization formats for communication? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2016-11-11 22:00 +0000
Re: Do you use serialization formats for communication? Tim Wescott <seemywebsite@myfooter.really> - 2016-11-11 17:51 -0600
Re: Do you use serialization formats for communication? Tom Gardner <spamjunk@blueyonder.co.uk> - 2016-11-12 00:07 +0000
Re: Do you use serialization formats for communication? Vincent vB <embedded@spam.com> - 2016-11-29 15:54 +0100
csiph-web