TEMU: MIL-STD-1553 Bus Model Manual

Transcription

Doc. no: TERMA/SPD/63/TEMU/BUS/MILBUSPUBLICRev: 1.2Date: 2017-05-04Approved By:TEMUMIL-STD-1553 Bus Model ManualMattias HolmVersion 1.2, 2017-05-04 Terma GmbH, Germany, 2016-2017. Proprietary and intellectual rights of Terma GmbH, Germany are involved in the subject-matter of this material and all manufacturing, reproduction, use,disclosure and sales rights pertaining to such subject-matter are expressly reserved. This material is submitted for a specific purpose as agreed in writing, and the recipient by accepting this materialagrees that this material will not be used, copied or reproduced in whole or in part, nor its content (or any part thereof) revealed in any manner or to any third party, except own staff, to meet thepurpose for which it was submitted and subject to the terms of the written agreement.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage ii of 6Table of Contents1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12. Bus Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13. Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.1. Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13.2. Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.3. Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.4. Notifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.5. Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23.6. Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34. Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35. Writing Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.1. Bus Controllers and Remote Terminals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35.2. Bus Monitors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56. Capture Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5The use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 1 of 6Table 1. Record of ChangesRevDateAuthorNote1.22017-05-14MHFix type in device interface.1.12016-05-12MHAuto gen tables.1.02016-04-05MHInitial version.1. IntroductionThis document describes the TEMU MIL-STD-1553 bus model and its interfaces. The MIL-STD-1553standard is often referred to as simply milbus or 1553.The 1553 protocol is described in detail in the well known "MIL-STD-1553 Tutorial" document fromAIM GmbH (formerly published by Condor). It is recommended that persons involved withmodelling bus controllers and remote terminals keep a copy of that document at close hand.The TEMU support for the 1553 protocol consist of a bus interface (Mil1553BusIface), a bus model(MilStd1553Bus) and a bus client interface (Mil1553DevIface).This approach enables the user to not only implement remote terminal models, but also toimplement their own bus models would the bundled one not be found suitable (e.g. if the user haveexisting remote terminal models that must be integrated with specific interfaces).The most common task for the end user will normally be to implement remote terminal models, butbus controllers are also possible as they use the same interface.2. Bus ModelThe 1553 bus model is available as a class with the name MilStd1553Bus in the TEMU "BusModels"plugin.3. Attributes3.1. PropertiesNameTypebcirefdevices[32 x iref]lastCmduint16 tobject.timeSourceobjectDescriptionTime source object (a cpu ormachine object)receiverRTint8 tThe use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 2 of 6NameTypestats.lastReportSentWordsuint64 tstats.sentWordsuint64 ttransmitterRTint8 tDescription3.2. scription3.3. PortsPropIfaceDescription---3.4. NotificationsThe default TEMU milbus model issues the following notifications:NameDescriptionParam Typetemu.mil1553StatStatistics notification.temu Mil1553Stats*temu.mil1553SendValid message in transit.temu Mil1553Msg*The statistics notification is issued when calling the reportStats function in the bus interface. Theuser can call this function from a timed event handler if needed. Another interesting calling point isto force statistics reporting at a PPS tick, i.e. a PPS device issues the call to the milbus object toreport the statistics, and can attempt to post other events at minor cycle intervals for example. Thisway the stat event can be used to monitor whether the system keeps the milbus budget.The send notification receives a pointer with the actual message in transit, but before it has beendelivered to the remote terminal (but after the bus object has rejected any messages transmittedillegally). The notification handler is free to modify the message, for example it is possible to set theErr field in the message struct to inject a transfer error, the RT can then set the message error bit inthe status word.3.5. ConfigurationThe bus model is configured using the Mil1553BusIface. The main work is to call the connectfunction to insert a remote terminal at the given subaddress.SetBusController should be called to set the current bus controller (note, this can be done atruntime).The use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 3 of 6The construction of a network with 1553 devices are simplified by using the following commands inthe command line interface: mil-std-1553-connect bus b rt rt addr 1 mil-std-1553-disconnect bus b addr 1 mil-std-1553-setbc bus b bc bc3.6. LimitationsThe bus object does not support bus monitors in the normal sense, however, it is possible to turn onthe temu.mil1553Send notification and listen in on all traffic using this notification interface.For the command line support, only models with one and only one device interface with the nameMil1553DevIface is supported. This may change in the future.4. Interfacestypedef struct temu Mil1553BusIface {void (*connect)(void *Bus, int Subaddr, temu Mil1553DevIfaceRef Device);void (*disconnect)(void *Bus, int Subaddr);void (*reportStats)(void *Bus);void (*send)(void *Bus, void *Sender, temu Mil1553Msg *Msg);// Controls whether events should be issued at send callsvoid (*enableSendEvents)(void *Bus);void (*disableSendEvents)(void *Bus);void (*setBusController)(void *Bus, temu Mil1553DevIfaceRef Device);} temu Mil1553BusIface;typedef struct temu Mil1553DevIface {void (*connected)(void *Device, temu Mil1553BusIfaceRef Bus, int SubAddr);void (*disconnected)(void *Device, temu Mil1553BusIfaceRef Bus, int SubAddr);void (*receive)(void *Device, temu Mil1553Msg *Msg);} temu Mil1553DevIface;5. Writing Clients5.1. Bus Controllers and Remote TerminalsBus controllers and remote terminals can be implemented using the Mil1553BusIface interface.This interface is defined in "temu-c/Bus/MilStd1553.h".The interface consist of the connected, disconnected and receive functions. These are all mandatoryThe use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 4 of 6and they are called whenever a virtual cable is connected and disconnected, or when a 1553 busmessage is received.A remote terminal needs to know about the bus it is connected to so it can use the send function inthe Mil1553BusIface interface. Do not call the bus send function from the device receive function, doing so willresult in undefined behaviour. If a response is to be issued due to handling of areceive, ensure that an event is posted on the model’s event queue source.The TEMU 1553 API follows the standard fairly well and subdivides 1553 transactions in phaseswhich are command, data, status and mode command phases. To send a receive command, the buscontroller will first send a message of the type teMT Cmd, followed by a teMT Data message. Theremote terminal is then expected to respond with a teMT Stat message. The remote terminal andbus controller model is responsible for issuing the different messages with delays. Delays can becomputed using the temu mil1553TransferTime() function.Messages should be sent in whole when they are supposed to arrive. This means that the buscontroller model can immediately raise any needed interrupts when a message is complete. The TEMU default 1553 bus model will print error messages if a remote terminaldoes not follow the 1553 protocol phases properly (e.g. sending a status response toa broadcast message).voidreceive(void *Device, temu Mil1553Msg *Msg){MyRT *RT (MyRT*)Device;//.// Start sending responsetemu eventPostNanos(RT- Super.TimeSource, RT- TransferCompleteEvent,temu mil1553TransferTime(1), // One word for status messageteSE Cpu);}voidtransferComplete(temu Event *Ev){MyRT *RT (MyRT*)Ev- Obj;uint16 t Stat computeStatWord(RT);temu Mil1553Msg Msg temu mil1553CreateStatMsg(&Stat);RT- Bus.Iface- send(RT- Bus.Obj, RT, &Msg); // Send the message}The use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 5 of 65.2. Bus MonitorsThe 1553 bus interface does not support the implementation of bus monitors directly at thismoment. The reason for this is that, the message notification interface already allows the system toinspect all the bus traffic executed. The notification interface can also be used to modify traffic insitu (e.g. to flip the error flags in the message object). Terma appreciates that there may be need forsome users to support modelling of bus monitors, please contact Terma if this is needed.6. Capture DeviceTEMU is bundled with a MILBUS capture device that enables capturing of the bus traffic. There arethree supported options for message capture: Logging command words issued to the TEMU log with partial decoding CSV output with command words and partial decodes of them PCAPNG file with all data transferred. File can be loaded in Wireshark if needed.To create a logging capture device, create the bus capture instance using:Forlogging:object-createclass MilStd1553BusCapturername milbus-cap0\args fmt:log,bus:milbus0For CSV output (into milbus0.csv): object-create class MilStd1553BusCapturer name milbus-cap0 \args png):object-createclass MilStd1553BusCapturername milbus-cap0 \ args fmt:pcapng,bus:milbus0Do not forget to set the time source for the capture device: connect-timesource obj milbus-cap0ts cpu0While the logging and CSV modes should be clear enough, there are some notes to be providederegarding the PCAPNG format.Firstly, the capture model captures logical units in the protocol, that is, command words arecaptured by themselves, as is status messages and data messages.Secondly, the capture model use the flags in the frame block to mark where the data came from.That is, it flags unicast, and broadcast messages as such, and it also flags the direction as outboundfor frames emitted by the BC (e.g. command words, mode codes, data sent to RTs etc) and inboundfor data sent from RTs.Thirdly, LINKTYPE USER0 is used for the device type (there is no standardised milbus link type),this linktype is not supported directly by Wireshark, and a dissector needs to be implemented tomake frames more human readable.Due to these caveats, interpreting the 1553 protocol in Wireshark is a bit tricky, but in general, weThe use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

TEMU: MIL-STD-1553 Bus Model ManualDoc. no: TERMA/SPD/63/TEMU/BUS/MILBUSRev. no: 1.2PUBLICPage 6 of 6can say that command sequences starts with outbound frames, which are followed by inboundframes. A dissector (or human viewing without a dissector) needs to be clever about decoding theseframes and take into account the previous frames sent, it is likely also necessary in case of failedtransfers to take into account such flags as well as buscontrollers tend to retry message transfers ifthey fail.The use and/or disclosure,etc. of the contents of this document (or any part thereof) is subject to the restrictions referenced on the front page.

The 1553 protocol is described in detail in the well known "MIL-STD-1553 Tutorial" document from AIM GmbH (formerly published by Condor). It is recommended that persons involved with modelling bus controllers and rem