MX Foundation 4
Error Detection

The control field of the MXF_ASYNCEH_DATAREC is used to detect errors on the received record. Only a parity and a stop bit error can be detected on a received record.

The example below shows how a program can receive ASYNC words and detect receive errors.

The characters are read from the rx buffer and each record is check for data error.

The receive errors can be detected at two levels:

  • With the datarec control field
  • Further, we also check for queue detected errors by using the status parameters of the function. Typical errors of this type are reception queue overflow because the data was not read fast enough.
{
// Reads the acquisition data
rc = mxfASYNCEHRxAcqRead(rxBuffer, 0xFFFFFFFF, sizeof(rec), &status, &msgCount, &byteCount, rec);
if(!rc)
{
if(status & MXF_RXACQ_STATUS_OVERFLOW)
printf("Acquisition Buffer overflow \n");
if(status & MXF_RXACQ_STATUS_BUFFER_FULL)
printf("Acquisition Buffer full \n");
if(status & MXF_RXACQ_STATUS_MODULE_PORT_OVERFLOW)
printf("Acquisition Module overflow \n");
if(status & MXF_RXACQ_STATUS_OUT_OF_RESOURCE)
printf("Acquisition out of resources \n");
// Checks error detected on a message basis
asyncRec = (MXF_ASYNCEH_DATAREC*)rec;
for(i=0; i < msgCount; i++)
{
if(asyncRec->control & MXF_ASYNCEH_RX_REC_CTRL_PARITY_ERROR)
printf("Async record #%d -> parity error \n", i);
if(asyncRec->control & MXF_ASYNCEH_RX_REC_CTRL_STOPBIT_ERROR)
printf("Async record #%d -> stop bit error \n", i);
mxfASYNCEHNextDataRecordPtrGet(asyncRec, &asyncRec);
}
}
}
Updated 10/23/2023