MX Foundation 4
Basic Transmission

In order to transmit data using an AFDX COM Sampling port you must:

Sampling default option is to only transmit when new data is written to the port buffer. MXF_A664_PORT_SAMPLING_OPT_SEND_STALE_DATA allows to continuously send data even if new data is not available, the current data will continue to be transmitted at the specified rate.

Example

ar664_sampling.c
The code snippets below demonstrate the basic steps needed to setup a Sampling COM port transmission.

// Create the transmission (TX) virtual link
if (!rc)
{
memset(&vlParam, 0, sizeof(MXF_A664_VL_PARAM));
vlParam.direction = MXF_A664_VL_DIR_TX;
vlParam.VLId = vlid;
vlParam.frameType = MXF_A664_FRAME_TYPE_ARINC664;
vlParam.frameSizeMax = 512;
vlParam.dir.Tx.subVlNumber = 1;
vlParam.dir.Tx.bag = 1 * 1000 * 1000; // 1ms
vlParam.dir.Tx.netSelection = MXF_A664_NETSELECT_ALL;
vlParam.dir.Tx.Ede.enable = FALSE;
vlParam.dir.Tx.subVl[0].bufferSize = vlParam.frameSizeMax;
vlParam.dir.Tx.subVl[0].maxBuffers = maxTxRecords;
rc = mxfA664VlCreate(phyChn, &vlParam, &vlTx);
}
// Create the transmission COM port
if (!rc)
{
inet_pton(AF_INET, DST_IP_ADRS, &srcIpAdrs);
inet_pton(AF_INET, SRC_IP_ADRS, &dstIpAdrs);
memset(&portParam, 0, sizeof(MXF_A664_PORT_PARAM));
portParam.portType = MXF_A664_PORT_TYPE_COM;
portParam.family = MXF_A664_PORT_FAMILY_IPV4;
portParam.mode = MXF_A664_PORT_MODE_SAMPLING;
portParam.dir.Tx.Sampling.rate = 10 * 1000 * 1000; // 10ms
// This option allows to send the same data if no new data is available
//portParam.dir.Tx.Sampling.options = MXF_A664_PORT_SAMPLING_OPT_SEND_STALE_DATA;
portParam.type.COM.destAddress.port = DST_UDP_PORT;
portParam.type.COM.destAddress.version.IPv4.address = ntohl(dstIpAdrs);
portParam.type.COM.srcAddress.port = SRC_UDP_PORT;
portParam.type.COM.srcAddress.version.IPv4.address = ntohl(srcIpAdrs);
rc = mxfA664PortCreate(vlTx, &portParam, &portTx);
}
// Build the Transmit Record
memset(&txRec, 0, sizeof(txRec));
txRec.dataSize = TEST_DATASIZE;
txRec.repeatCount = 1;
for (dataIdx = 0; dataIdx < TEST_DATASIZE; dataIdx++)
txRec.data[dataIdx] = (uint8)((dataIdx + ((count*TEST_DATASIZE) & 0xff)));
rc = mxfA664TxPeriodicUpdateMsgWrite(portTx, 1, &txRec);
...
if (!rc)
rc = mxfA664PortRelease(portTx);
...
Updated 10/23/2023