linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (unknown)
@ 2002-08-27  1:48 Alex Pavloff
  2002-08-27  9:59 ` your mail Gerald Emig
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Pavloff @ 2002-08-27  1:48 UTC (permalink / raw)
  To: 'linux-serial@vger.kernel.org'


Good (morning/afternoon/evening) folks,

I am writing Modbus RTU code for Linux 2.4.19.  While seeminly simple to do
in userspace, there's one big kicker that I can't handle there easily.
Modbus RTU is a binary serial protocol used in industrial automation.  First
used by the Modicon PLCs, it's found on a variety of devices from a variety
of manufacturers.

The specification is at www.modbus.org, under "Modbus Standard Library", and
its the Modbus Serial Protocol Reference Guide.

Here's the part that I don't think I can resolve in userspace:
-----
RTU Framing
In RTU mode, messages start with a silent interval of at least 3.5 character
times. This is most easily implemented as a multiple of character times at
the baud rate that is being used on the network (shown as T1-T2-T3-T4 in the
figure below). The first field then transmitted is the device address.

The allowable characters transmitted for all fields are hexadecimal 0-9,
A-F. Networked devices monitor the network bus continuously, including
during the 'silent' intervals. When the first field (the address field) is
received, each device decodes it to find out if it is the addressed device.

Following the last transmitted character, a similar interval of at least 3.5
character times marks the end of the message. A new message can begin after
this interval.

The entire message frame must be transmitted as a continuous stream. If a
silent interval of more than 1.5 character times occurs before completion of
the frame, the receiving device flushes the incomplete message and assumes
that the next byte will be the address field of a new message.
-----

3.5 character times at high baud rates is not something I can pull off with
termios.  To get the Modbus RTU frames without resorting to some really
strange code in userspace, should I write a line-discipline module whose
sole purpose is to deal with the character timing?

Any comments (yay/nay/huh?) appreciated.

Alex Pavloff
Software Engineer
Eason Technology
 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: your mail
  2002-08-27  1:48 (unknown) Alex Pavloff
@ 2002-08-27  9:59 ` Gerald Emig
  0 siblings, 0 replies; 6+ messages in thread
From: Gerald Emig @ 2002-08-27  9:59 UTC (permalink / raw)
  To: Alex Pavloff; +Cc: 'linux-serial@vger.kernel.org'


To wait for at least 3.5 character times you can simply wait for this time
or more using usleep() before sending your data.

On Mon, 26 Aug 2002, Alex Pavloff wrote:

>
> Good (morning/afternoon/evening) folks,
>
> I am writing Modbus RTU code for Linux 2.4.19.  While seeminly simple to do
> in userspace, there's one big kicker that I can't handle there easily.
> Modbus RTU is a binary serial protocol used in industrial automation.  First
> used by the Modicon PLCs, it's found on a variety of devices from a variety
> of manufacturers.
>
> The specification is at www.modbus.org, under "Modbus Standard Library", and
> its the Modbus Serial Protocol Reference Guide.
>
> Here's the part that I don't think I can resolve in userspace:
> -----
> RTU Framing
> In RTU mode, messages start with a silent interval of at least 3.5 character
> times. This is most easily implemented as a multiple of character times at
> the baud rate that is being used on the network (shown as T1-T2-T3-T4 in the
> figure below). The first field then transmitted is the device address.
>
> The allowable characters transmitted for all fields are hexadecimal 0-9,
> A-F. Networked devices monitor the network bus continuously, including
> during the 'silent' intervals. When the first field (the address field) is
> received, each device decodes it to find out if it is the addressed device.
>
> Following the last transmitted character, a similar interval of at least 3.5
> character times marks the end of the message. A new message can begin after
> this interval.
>
> The entire message frame must be transmitted as a continuous stream. If a
> silent interval of more than 1.5 character times occurs before completion of
> the frame, the receiving device flushes the incomplete message and assumes
> that the next byte will be the address field of a new message.
> -----
>
> 3.5 character times at high baud rates is not something I can pull off with
> termios.  To get the Modbus RTU frames without resorting to some really
> strange code in userspace, should I write a line-discipline module whose
> sole purpose is to deal with the character timing?
>
> Any comments (yay/nay/huh?) appreciated.
>
> Alex Pavloff
> Software Engineer
> Eason Technology
>
>

Gerald Emig




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: your mail
  2020-09-03 17:36 Barnett, Andy
@ 2020-09-18  7:56 ` Johan Hovold
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2020-09-18  7:56 UTC (permalink / raw)
  To: Barnett, Andy; +Cc: linux-serial

On Thu, Sep 03, 2020 at 05:36:34PM +0000, Barnett, Andy wrote:
> Title - Edgport/4 compatibility question

> Disclaimer: This email and any attachments are sent in strictest confidence for the sole use of the addressee and may contain legally privileged, confidential, and proprietary data. If you are not the intended recipient, please advise the sender by replying promptly to this email and then delete and destroy this email and any attachments without any further use, copying or forwarding.

Please resend with a proper Subject line and without the above
disclaimer.

And remember to CC the USB list (linux-usb@vger.kernel.org).

Johan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: your mail
       [not found] <20191026192359.27687-1-frank-w@public-files.de>
@ 2019-10-26 19:30 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2019-10-26 19:30 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: linux-mediatek, Matthias Brugger, linux-serial, linux-arm-kernel,
	linux-kernel

On Sat, Oct 26, 2019 at 09:23:59PM +0200, Frank Wunderlich wrote:
> Date: Sat, 26 Oct 2019 20:53:28 +0200
> Subject: [PATCH] serial: 8250-mtk: Ask for IRQ-count before request one

Odd email with no subject line :(

Plaese fix up and resend.

thanks,

greg k-h-

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: your mail
  2004-08-24  6:05 (unknown) Francisco M. Marzoa Alonso
@ 2004-08-24  9:39 ` Jan-Benedict Glaw
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2004-08-24  9:39 UTC (permalink / raw)
  To: Francisco M. Marzoa Alonso; +Cc: linux-serial

[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]

On Tue, 2004-08-24 08:05:08 +0200, Francisco M. Marzoa Alonso <fmmarzoa@softronica.org>
wrote in message <200408240805.08811.fmmarzoa@softronica.org>:
> >>       TOut.tv_sec = Wait / 1000;
> >>       TOut.tv_usec = Wait % 1000;
> >
> >So "Wait" is in milli-seconds? That doesn't look correct, then:)
> >
> >        TOut.tv_sec = Wait / 1000;
> >        TOut.tv_usec = (Wait % 1000) * 1000;
> 
> Sure you're right, but this is a thing that I do not understand. I made a 
> function GetTickCount to emulate Window's one based on gettimeofday and see 
> that milliseconds on timeval structure can have values up to 999999 when I 
> expect to found a maximum value of 999 as there are only 1000 milliseconds in 
> a second.

Notice, it's not "tv_msec" but "tv_usec", which is micro-seconde and
not milli-seconds. A small 'u' is commonly used instead of the greek
'µ', because 'µ' won't be properly handled by all email clients, let
alone in code to be compiled.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: your mail
@ 2002-08-27 16:55 Alex Pavloff
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Pavloff @ 2002-08-27 16:55 UTC (permalink / raw)
  To: 'Gerald Emig'; +Cc: 'linux-serial@vger.kernel.org'


Hi Gerald, here's some more info:

Sending data isn't the problem.  The problem is acting as a slave and
receiving unsolicited packets from a master.   I need to determine when a
packet is complete.  If I was sending the packets (which I have done before
and am doing now), I can cheat a bit because I know the length of the packet
I'm "supposed" to be getting back.   I can't do that when acting as a slave.

This is different that the other protocol I'm familiar with.

GE's SNP uses two packets -- the first fixed size and containing the length
of the second size.
AB's DF1 has a fixed packet structure with many special characaters that
makes it easy to pull in a piece at a time

With Modbus RTU I neither know how long a packet is going to be, nor do I
have a sequence of bytes that can be used to judge the end of a packet.  I
need to be able to understand that 3.5 characters times of nothing means the
end of the packet.

Do I need a line discipline for this one portion of the driver?

Alex Pavloff
Software Engineer
Eason Technology
 


-----Original Message-----
From: Gerald Emig [mailto:gme@emig-software.de]
Sent: Tuesday, August 27, 2002 3:00 AM
To: Alex Pavloff
Cc: 'linux-serial@vger.kernel.org'
Subject: Re: your mail



To wait for at least 3.5 character times you can simply wait for this time
or more using usleep() before sending your data.

On Mon, 26 Aug 2002, Alex Pavloff wrote:

>
> Good (morning/afternoon/evening) folks,
>
> I am writing Modbus RTU code for Linux 2.4.19.  While seeminly simple to
do
> in userspace, there's one big kicker that I can't handle there easily.
> Modbus RTU is a binary serial protocol used in industrial automation.
First
> used by the Modicon PLCs, it's found on a variety of devices from a
variety
> of manufacturers.
>
> The specification is at www.modbus.org, under "Modbus Standard Library",
and
> its the Modbus Serial Protocol Reference Guide.
>
> Here's the part that I don't think I can resolve in userspace:
> -----
> RTU Framing
> In RTU mode, messages start with a silent interval of at least 3.5
character
> times. This is most easily implemented as a multiple of character times at
> the baud rate that is being used on the network (shown as T1-T2-T3-T4 in
the
> figure below). The first field then transmitted is the device address.
>
> The allowable characters transmitted for all fields are hexadecimal 0-9,
> A-F. Networked devices monitor the network bus continuously, including
> during the 'silent' intervals. When the first field (the address field) is
> received, each device decodes it to find out if it is the addressed
device.
>
> Following the last transmitted character, a similar interval of at least
3.5
> character times marks the end of the message. A new message can begin
after
> this interval.
>
> The entire message frame must be transmitted as a continuous stream. If a
> silent interval of more than 1.5 character times occurs before completion
of
> the frame, the receiving device flushes the incomplete message and assumes
> that the next byte will be the address field of a new message.
> -----
>
> 3.5 character times at high baud rates is not something I can pull off
with
> termios.  To get the Modbus RTU frames without resorting to some really
> strange code in userspace, should I write a line-discipline module whose
> sole purpose is to deal with the character timing?
>
> Any comments (yay/nay/huh?) appreciated.
>
> Alex Pavloff
> Software Engineer
> Eason Technology
>
>

Gerald Emig



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-18  7:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-27  1:48 (unknown) Alex Pavloff
2002-08-27  9:59 ` your mail Gerald Emig
2002-08-27 16:55 Alex Pavloff
2004-08-24  6:05 (unknown) Francisco M. Marzoa Alonso
2004-08-24  9:39 ` your mail Jan-Benedict Glaw
     [not found] <20191026192359.27687-1-frank-w@public-files.de>
2019-10-26 19:30 ` Greg Kroah-Hartman
2020-09-03 17:36 Barnett, Andy
2020-09-18  7:56 ` your mail Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).