MX Foundation 4
Periodic Update Message Service

The BC channel of MIL-1553 modules supports this service (Logical channel 1 & 35).

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 BC, each message must be associated with a buffer. The TX Periodic Update Message Service is useful to update the data of this buffer for RX message. The message queue is also useful for TX messages and mode-code for error injection. For this message type, the data is ignored but the specified error index will be updated. It is possible to allocate a 0 byte buffer which can be useful for TX message that will not have to be updated for error injection, that way no memory is used to allocate the queue. It is also possible to link more than one message to the same buffer.

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

Refer to the MXF_MIL1553_DATAREC structure for data updating.

Periodic message updating step:

Note
Only the RX messages and mode code #17, #20 and #21 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.

HMXF_CHANNEL bc=0;
HMXF_BUFFER tx=0;
size_t txBufferSize=0;
MXF_MIL1553_DATAREC* txBuffer=NULL;
...
// Allocates 1 KB buffer for BC update
if(!rc)
{
txBufferSize = 1*1024;
// Allocates BC update buffer
rc=mxfTxPeriodicUpdateMsgBufferAlloc(bc, 0, txBufferSize, &tx, NULL);
// Host buffer allocation
if(!rc)
{
txBuffer = (MXF_MIL1553_DATAREC*)malloc(txBufferSize);
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
// Set default data for address 5, subaddress 3
if(!rc)
{
txRec1553 = (MXF_MIL1553_DATAREC *)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] = 0x0000;
txRec1553->data[2] = 0x1111;
txRec1553->data[3] = 0x2222;
txRec1553->data[4] = 0x3333;
txRec1553->data[5] = 0x4444;
txRec1553->data[6] = 0x5555;
txRec1553->data[7] = 0x6666;
txRec1553->data[8] = 0x7777;
txRec1553->data[9] = 0x8888;
txRec1553->data[10] = 0x9999;
txRec1553->data[11] = 0xAAAA;
txRec1553->data[12] = 0xBBBB;
txRec1553->data[13] = 0xCCCC;
txRec1553->data[14] = 0xDDDD;
txRec1553->data[15] = 0xEEEE;
txRec1553->data[16] = 0xFFFF;
rc = mxfMIL1553TxPeriodicUpdateMsgWrite(tx, 1, txBuffer);
}
...

mil1553_bc.c

Updated 10/23/2023