MX Foundation 4
Errors Detection

The control field of the MXF_HDLC_DATAREC is used to detect errors on the received record. Many errors can detected on the receive record, such as : frame size error, abort frame error, FCS error, decoding error, etc..

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

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

The received errors can be detected at two levels:

  • The first, is to use the datarec control field.
  • The second, is to 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.
{
HMXF_BUFFER rxBuffer;
uint64 status, msgCount, byteCount;
uint64 i;
...
// Reads the acquisition data
rc = mxfHDLCRxAcqRead(rxBuffer, 0, 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
hdlcRec = (MXF_HDLC_DATAREC*)rec;
for(i=0; i < msgCount; i++)
{
if(hdlcRec->control & MXF_HDLC_RX_REC_CTRL_FRAMESIZE_ERROR)
printf("Hdlc record #%d -> frame size error \n", i);
if(hdlcRec->control & MXF_HDLC_RX_REC_CTRL_FCS_ERROR)
printf("Hdlc record #%d -> FCS error \n", i);
mxfHDLCNextDataRecordPtrGet(hdlcRec, &hdlcRec);
}
}
...
}
Updated 10/23/2023