i've got some issue when i added address check in SmartPreamble example (swrc274a).
So i added
{CC120X_PKT_CFG1, 0x13, 0x00},
{CC120X_DEV_ADDR, 0x05, 0x00}
into customRegisterSettings[] for RX project.
and added address field in function createPacket() on a TX side. now this function:
static void createPacket(void) {
uint16 checksum;
uint16 i;
txBuffer[SMARTPREAMBLE_LEN] = 0x55; // Preamble
txBuffer[SMARTPREAMBLE_LEN + 1] = 0x55; // Preamble
txBuffer[SMARTPREAMBLE_LEN + 2] = 0x55; // Preamble
txBuffer[SMARTPREAMBLE_LEN + 3] = 0x55; // Preamble
txBuffer[SMARTPREAMBLE_LEN + 4] = 0xD0; // Payload SYNC1
txBuffer[SMARTPREAMBLE_LEN + 5] = 0xC9; // Payload SYNC0
txBuffer[SMARTPREAMBLE_LEN + 6] = 21; // Length byte
txBuffer[SMARTPREAMBLE_LEN + 7] = 0x05; // Address byte
// Payload with random data
uint8_t temp = 0x01;
for(uint16_t i = (SMARTPREAMBLE_LEN + 8);
i < (SMARTPREAMBLE_LEN + 8 + PAYLOAD_LENGTH); i++) {
txBuffer[i] = temp++;
}
// Generate CRC for the data packet
checksum = CRC_INIT;
for(i = (SMARTPREAMBLE_LEN + 6);
i <= (SMARTPREAMBLE_LEN + 7 + PAYLOAD_LENGTH); i++) {
checksum = calcCRC(txBuffer[i], checksum);
}
txBuffer[SMARTPREAMBLE_LEN + PAYLOAD_LENGTH + PAYLOAD_OVERHEAD - 2] =
(uint8_t)(checksum >> 8);
txBuffer[SMARTPREAMBLE_LEN + PAYLOAD_LENGTH + PAYLOAD_OVERHEAD - 1] =
(uint8_t)(checksum & 0x00FF);
}
and in file cc120x_smartpreamble_settings.h i've changed
#define PAYLOAD_OVERHEAD 9
to
#define PAYLOAD_OVERHEAD 10
and it works only when i set NUM_TIMESTAMP_PACKETS in range 2 - 5.
Address filtering works i test this. with NUM_TIMESTAMP_PACKETS 2.
But if i set NUM_TIMESTAMP_PACKETS to 50 i've got 70% lost packets.
if i set NUM_TIMESTAMP_PACKETS to 250 i've got 99% lost packets.
what am I missing?