min-protocol / min

The MIN protocol specification and reference implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about sequence numbers

mikemoretti3 opened this issue · comments

Hi,

I'm trying to use the MIN protocol for a board that talks to 4 other boards via RS485 using one UART (with 8 RS485 transceivers, 4 on the control board and one on each sub board). Unfortunately, the control board sequence numbers increment 4 times faster than the sub-boards and so any message after the first ACK from the control board will not be handled by any board except the first. Is there some reason you used '==' for the sequence number check instead of >=? From what I remember, TCP does it that way (i.e. it doesn't care if the sequence number is equal but only if it's >=). I'd prefer not to have to use 4 min_contexts for my comms.

Thanks!
-m

The problem is that sequence numbers are not monotonic: they wrap around, and so comparisons can't be simple > or <.

If you don't really need the transport features and your application can just transmit its state periodically then you could just use the basic MIN layer, which would cut the overheads down a lot.

@mikemoretti3 did you ever come up with a solution to this? I'm also playing around with MIN and RS485, trying to work out how to deal with the half-duplex flow control aspect

no, i gave up on this protocol and developed my own. but this problem only occurred when talking to multiple boards from one main board. from your comment it doesn't sound like that's what you're doing?

I designed MIN for MCU-host communications rather than a multidrop bus because there wasn't anything simple to do the job. But if you want a multidrop bus protocol there are other options. Have you come across LIN?

no, i gave up on this protocol and developed my own. but this problem only occurred when talking to multiple boards from one main board. from your comment it doesn't sound like that's what you're doing?

Yeah I might end up doing my own protocol, I was actually just trying to not re-invent the wheel haha. I actually have a couple of devices on a single bus (that control servo motors) and a main controller. Really the system can be one direction half duplex controller -> slave, which will help with arbitration. I'll likely do something simple like $$"node id"*"len"#"payload ascii only"@"CRC"/n
The system is critical, so I need all the error checking capability, very low bandwidth however so even MIN is a bit over the top.

I designed MIN for MCU-host communications rather than a multidrop bus because there wasn't anything simple to do the job. But if you want a multidrop bus protocol there are other options. Have you come across LIN?

You are correct, MIN is awesome and I've actually used it for another project before in the past with great success, but not ideal for this application actually. LIN is actually a brilliant idea, never used it before but could fit the bill well. Also likely to be some good libraries out there to same me some time.