Other Parts Discussed in Thread: CC1312R, CC1101,
Hi team,
Here's an issue from the customer may need your help:
Referenced to DN504 FEC implementation, the customer FEC code the source data (0x01 0x02 0x03 0x04 0x05) with the following data: 4C F0 30 10 C8 7C C3 23 40 34 7C E3.
And referenced to DN507 FEC Decoding to decode the above encoded data and got the following data: 0x01 0x02 0x73 0x04 0x05, which is inconsistent with the source data.
// NUMBER_OF_BYTES_AFTER_DECODING should be given the length of the payload + CRC (CRC is optional) #define NUMBER_OF_BYTES_AFTER_DECODING 5 #define NUMBER_OF_BYTES_BEFORE_DECODING (4 * ((NUMBER_OF_BYTES_AFTER_DECODING / 2) + 1)) /******************************************************************************* * @fn: * @brief: * @para: * @return: ******************************************************************************/ void ReadRxFifo(uint8_t* rxBuf, uint16_t startAddr, uint16_t readLen) { // 01 02 03 04 05 const uint8_t rxRawData[] = { // 0x4C, 0xF0, 0x30, 0x10, // 0xC8, 0x7C, 0xC3, 0x23, // 0x40, 0x34, 0x7C, 0xE3, // }; uint8_t iX; for (iX = 0; iX < readLen; iX++) { if (startAddr + iX >= sizeof(rxRawData)) { break; } rxBuf[iX] = rxRawData[startAddr + iX]; } } /******************************************************************************* * @fn: * @brief: * @para: * @return: ******************************************************************************/ void main(void) { unsigned short checksum; unsigned short nBytes; unsigned char *pDecData = rxPacket; // Destination for decoded data uint16_t total = 0; // Init MCU and Radio while (1) { // while (!packetReceived) // ; // Wait for packet to be received (64 bytes in the RXFIFO) // packetReceived = 0; memset(rxPacket, 0, sizeof(rxPacket)); pDecData = rxPacket; // Perform de-interleaving and decoding (both done in the same function) fecDecode(NULL, NULL, 0); // The function needs to be called with a NULL pointer for // initialization before every packet to decode nBytes = NUMBER_OF_BYTES_AFTER_DECODING; total = 0; while (nBytes > 0) { unsigned short nBytesOut; // readRxFifo(RF_RXFIFO, rxBuffer, 4); // Read 4 bytes from the RXFIFO and store them in rxBuffer ReadRxFifo(rxBuffer, total, 4); nBytesOut = fecDecode(pDecData, rxBuffer, nBytes); total += 4; nBytes -= nBytesOut; pDecData += nBytesOut; } // Running here, the rxPacket contents are 01 02 73 04 05 (hex) // Perform CRC check (Optional) { unsigned short i; nBytes = NUMBER_OF_BYTES_AFTER_DECODING; checksum = 0xFFFF; // Init value for CRC calculation for (i = 0; i < nBytes; i++) checksum = calcCRC(rxPacket[i], checksum); if (!checksum) { // Do something to indicate that the CRC is OK } } } }
Could you help check this case? Thanks.
Best Regards,
Cherry