This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1200: Device address check in SmartPreamble mode.

Part Number: CC1200

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?

  • Have you remembered to add address to all your timestamp packets as well?

    BR

    Siri

  • Thank you for reply.

    i've changed  TIMESTAMP_PACKET_LEN  to  8

    and modifyed generateSmartPreamble function as following

    void generateSmartPreamble(uint8* txBuffer) {
    uint16 i;
    uint16 checksum;

    // Generate the timestamps
    for(i = 0; i < NUM_TIMESTAMP_PACKETS; i++) {
        checksum = CRC_INIT;
        checksum = calcCRC(0x02, checksum);
        checksum = calcCRC(0x05, checksum);
        checksum = calcCRC((NUM_TIMESTAMP_PACKETS - 1) - i, checksum);

        txBuffer[(i * 8)] = 0x55;
        txBuffer[(i * 8) + 1] = 0x93;
        txBuffer[(i * 8) + 2] = 0x0B;
        txBuffer[(i * 8) + 3] = 0x02;//Length Byte
        txBuffer[(i * 8) + 4] = 0x05;//Address
        txBuffer[(i * 8) + 5] = (NUM_TIMESTAMP_PACKETS - 1) - i;
        txBuffer[(i * 8) + 6] = (uint8)(checksum >> 8);
        txBuffer[(i * 8) + 7] = (uint8)(checksum & 0x00FF);
        }
    }

    flashed both boards but it still doesn't work.

  • - Did you get this example to run unmodified?

    - Did you recalculate the tEvent0 time since adding an address byte in the time stamp packet will change the timing.  

    - After the modifications, you receive some packets. Have you checked that you receive the time stamp packet? Have you compared the time between the received packet and the start of the main packet and compared with the calculated time? 

  • unmodified example working fine.

     tEvent0 time recalculates by generateLookupEvent0Table function.

    anyway now everything is working fine, my mistake was in RX prj main.c where the timestamp number should be read.

    Siri, TER thank you for your help.