MX Foundation 4
Sampling Service

The BC channels on MIL-1553 modules support this service.

The sampling service on a BC channel is useful to sample the status and data that are sent to the BC from the RTs, but without resorting to the use of the BM channel.

With BC channels, this service must use the message mode. The monitor mode is an attribute changed on the BM channel, so in this case, the BM channel monitor mode must be set to message mode (see the KMXF_MIL1553_BM_MODE attribute). If the BM monitor mode is not set to message mode, BC channels will receive nothing. Sampling with BC channels work differently than with BM channels. The data transmitted by the BC is not received by this BC.

The following possibilities will be received by BC channel:

  • RXCmd/Status
  • TXCmd/Status/Data
  • TXModeCode/Status/Data (Data is optional)
  • RXModeCode/Data/Status (Data is optional)
Note
Broadcast, RT-RT transfer and no-response messages are not received by BC channels.

Refer to the MXF_MIL1553_SAMPREC structure for acquisition data reading.

The same options for sampling filtering of BM channels apply to BC channels.

uint32 rc;
HMXF_SERVER server;
HMXF_CHANNEL bm;
HMXF_BUFFER samp1553Buffer=0;
MXF_MIL1553_SAMPREC* sampRec1553;
uint32 rxDataSize=10*1024;
void* rxData=0;
uint64 msgCount;
uint64 byteCount;
uint64 rxRec;
...
// Sets timebase to RTC nsec
if(!rc)
rc = mxfSystemTimeBaseSet(server, MXF_TIMEBASE_DEVICE_NSEC);
// Allocates 10KB buffer for 1553 sampling data
if(!rc)
rc = mxfRxSamplingBufferAlloc(bm, rxDataSize, &samp1553Buffer, NULL);
// Host allocation
if(!rc)
{
rxData = malloc(rxDataSize);
if(!rxData)
rc = MAXT_ERROR_MEM;
}
if(!rc)
rc = mxfRxSamplingKilltimeSet(samp1553Buffer, 2000000000);
// Starts BM sampling
if(!rc)
rc = mxfRxSamplingStart(samp1553Buffer);
// Reads sampling
if(!rc)
rc = mxfMIL1553RxSamplingRead(samp1553Buffer, MXF_RXSAMPLING_FLAG_DEFAULT, 0, rxDataSize, &msgCount, &byteCount, (MXF_MIL1553_SAMPREC*)rxData);
sampRec1553 = (MXF_MIL1553_SAMPREC*)rxData;
for(rxRec=0; !rc && rxRec<msgCount; rxRec++)
{
printf("%012llu ", sampRec1553->timeTag);
printf("%03u ", sampRec1553->rate);
printf("%08X ", sampRec1553->control);
printf("%04u ", (sampRec1553->dataSize/2)-1);
for(data=0; data < min(5, sampRec1553->dataSize/2); data++)
{
printf("%04X ", sampRec1553->data[data]);
}
printf("\n\r");
// Gets next msg
mxfMIL1553NextSamplingRecordPtrGet(sampRec1553, &sampRec1553);
}
// Stops sampling
mxfRxSamplingStop(samp1553Buffer);
...

mil1553_bc_buserror_trigger.c

Updated 10/23/2023