Ethernet Module GW PCB Mounted gwy
RS-485 Communications
Under Construction
Gwy PCB Diagram Ethernet Shields & Modules Replacing EthMod Pins
W5500 Skiz Gateway Sketch Nano Pinouts & Skiz Nano Pin Definitions
Communications Definitions The Cable (RS-485 media)

05/08/22: Page Origin

The Gwy (gateway) sits between our HomeNet (Gigabit Ethernet) and the 485Net (RS-485 Network) connected control systems in the shop.   Gwy is the 485Net (RS-485 Network) master and controls all access to it.   Gwy monitors ethernet messages and polls slaves on the 485Net (Rs-485 Network).   Between each poll, Gwy checks for new Ethernet messages, and if one has arrived, Gwy passes it to the appropriate slave device and waits for it's response.    

Ethernet Messages
Have an 8 byte header followed by ASCII characters, terminated with a NewLine (NL).   The first 8 ASCII characters are a header, within the header, the 1st 4 characters are the packet's data length, the 2nd 4 chars are zeros for now.   The body of an Ethernet Message, following the header, will have a prefix indicating the recipient (like "ACT" for Air Conditioner Thermostat)   If the shop server needs additional arguments, they are preceeded by a '>' character.  

485Net messages
except for the header, contain only ascii characters, terminated by a newline (NL).   Each 485Net msg contains: a '#', a 2 digit destination host nbr, a 2 digit source host nbr, a Directive character, and optionally followed by arguments.  
The gateway is the master on the 485Net.   An ethernet slave request message will be forwarded to the slave, then the gateway will wait for a timed response from the slave.   A slave response may be data for the ethernet requestor or just a simple ACK or NAK.   If the slave doesn't respond in time, the Gwy sends SYN messages to reset all slaves on the 485Net.

Polling:
The master polls the slaves (destinations) on the 485Net for a slave needing service.   Slave responds with STX or NAK (negative).   If slave, needs to use the localnet it will answer with STX else NAK.   If the master is OK with slave using the net it responds with ACK granting the slave control of the 485Net.   Slave relenquishes 485Net control by sending EOT to master.   The master ignores all localnet traffic until the slave sends an ETX to the master or until a timeout occurs.   The master times the slave's use of localnet and after MASTERTIME expires, will reset (SYN char) all slaves and resume control of localnet.  

485Net Msg Directives
ENQ Request for service, optionally followed by arguments.
STX Requesting control of bus.
ETX Relinquishing control of bus.
ACK Recepient positive acknowledgement.
NAK Recepient negative acknowledgement.

For more information on ASCII control characters, please see this.  

Initial slave prefixes
ENV Environment server
DAS Dust Auto System
ACT Shop Air Cond Thermostat
DTR Data Terminal (part of Dust Auto)