MX Foundation 4
Periodic Update Message Service

The RT channel of MIL-1553 modules supports this service (Logical channel 2-33 & 36-67).

The Periodic Update Message Service allows a message for a specified buffer to be refreshed. The mxfMIL1553TxPeriodicUpdateMsgWrite() function is used to refresh the data of a specific buffer.

For the RT, the Periodic Update Message Service is useful to update the data for each of its TX subaddresses and TX mode-codes. The message queue is also useful for RX messages and RX mode-code for error injection. For this message type, the data is ignored but the specified error index will be updated.

In MIL-STD-1553 B mode, RT31 has a special meaning. Address 31 is the broadcast address and no RT should respond to a broadcast command. With MX Foundation, the RT31 should be activated to receive the broadcast data as it is not received on individual RT buffer and also to allow the other RTs to respond with the broadcast bit set in their status word when the BC transmits a broadcast command followed by a transmit status word or transmit last command mode code. In B mode, even if enabled, the RT31 will never respond to BC commands.

Every time a RT transmits a message from a subaddress, the associate message in the message queue will be sent. By default, the messages for all subaddresses are initialized to zero. If the message is not updated, 0 will be sent on the bus. When all messages of a subaddress queue have been sent, the last message will be repeated indefinitely while the message queue is no longer updated.

The message refreshing does not start until the RT is enabled. The mxfMIL1553RtEnableSet() function is used to enable the RT.

Each bus (A and/or B) of Remote Terminal RX subaddress, TX subaddress and mode-code may be enabled/disabled as required. By default, the bus A and B are disabled for each subaddress/mode-code, i.e. the RT does not respond to any BC commands. (See the mxfMIL1553RtSubsystemEnableSet() function)

Refer to the MXF_MIL1553_DATAREC structure for data updating.

Periodic message updating step:

Note
Only the TX messages and mode code #16 and #19 contain data word(s).

MXF_ASYNCEVENT_COND_TXPERIODIC_UPDATEMSG_BUFFER_THRESHOLD event condition can be registered so a callback handler can be automatically called when the number of messages of a buffer falls below a determined threshold.

#define CMD_TX 0
#define CMD_RX 1
#define CMD_MC 2
uint32 rc;
HMXF_CHANNEL rt;
HMXF_BUFFER tx[3];
uint32 txBufferSize=0;
MXF_MIL1553_DATAREC* txBuffer=NULL;
uint64 bus=0;
// Allocates 1KB buffer for tx data
if(!rc)
{
txBufferSize = 1024;
// RT 5: address=0, subaddress 3 TX
rc = mxfTxPeriodicUpdateMsgBufferAlloc(rt, CMD_TX, txBufferSize, &tx[CMD_TX], NULL);
// RT 5: address=0, subaddress 3 RX
if(!rc)
rc = mxfTxPeriodicUpdateMsgBufferAlloc(rt, CMD_RX, txBufferSize, &tx[CMD_RX], NULL);
// RT 5: Mode Command 16
if(!rc)
rc = mxfTxPeriodicUpdateMsgBufferAlloc(rt, CMD_MC, txBufferSize, &tx[CMD_MC], NULL);
// Host allocation
if(!rc)
{
txBuffer = (MXF_MIL1553_DATAREC*)malloc(txBufferSize);
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
// Enables the BUS A and B of RT 5 subaddress 3
if(!rc)
{
bus = MXF_MIL1553_BUS_A | MXF_MIL1553_BUS_B;
// TX
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_TX, 3, bus, tx[CMD_TX]);
// RX
if(!rc)
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_RX, 3, bus, tx[CMD_RX]);
}
// Enables the BUS A and B of RT 5 mode command 16
if(!rc)
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_MODECODE, 16, bus, tx[CMD_MC]);
// Sets default data for address 5, subaddress 3
if(!rc)
{
txRec1553 = txBuffer;
memset(txRec1553, 0, sizeof(MXF_MIL1553_DATAREC));
txRec1553->repeatCount = 1;
txRec1553->dataSize = 34; //34 bytes (command + 16 words)
txRec1553->data[0] = 0x0000; //Not used
txRec1553->data[1] = 0xFFFF;
txRec1553->data[2] = 0xEEEE;
txRec1553->data[3] = 0xDDDD;
txRec1553->data[4] = 0xCCCC;
txRec1553->data[5] = 0xBBBB;
txRec1553->data[6] = 0xAAAA;
txRec1553->data[7] = 0x9999;
txRec1553->data[8] = 0x8888;
txRec1553->data[9] = 0x7777;
txRec1553->data[10] = 0x6666;
txRec1553->data[11] = 0x5555;
txRec1553->data[12] = 0x4444;
txRec1553->data[13] = 0x3333;
txRec1553->data[14] = 0x2222;
txRec1553->data[15] = 0x1111;
txRec1553->data[16] = 0x0000;
rc = mxfMIL1553TxPeriodicUpdateMsgWrite(tx[CMD_TX], 1, txBuffer);
}
// Starts messages queues
if(!rc)
{
printf("Starting RT\n\r");
rc = mxfMIL1553RtEnableSet(rt, TRUE);
}
...
// Stops RT
if(!rc)
rc = mxfMIL1553RtEnableSet(rt, FALSE);
printf("\nStopping RT\n\r");
// Disables the BUS A and B of RT 5 subaddress 3
if(!rc)
{
bus = 0;
// TX
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_TX, 3, bus, tx[CMD_TX]);
// RX
if(!rc)
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_RX, 3, bus, tx[CMD_RX]);
}
// Disables the BUS A and B of RT 5 mode command 16
if(!rc)
rc = mxfMIL1553RtSubsystemEnableSet(rt, MXF_MIL1553_MSGTYPE_MODECODE, 16, bus, tx[CMD_MC]);
...

mil1553_rt.c

Updated 10/23/2023