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: Trouble reading standard packet or encrypted packet

Part Number: CC1200
Other Parts Discussed in Thread: MSP430FR5994

Dear Sirs:

     I'm having trouble receiving a standard packet and having the same trouble receiving encoded std packet.

IOCONFIG0 is set to 06.  Its positive edge interrupts and runs the receiver.  This occurs when sync has been received. 

Its negative edge also interrupts and sets packetSemaphore to 01 .  This should be when the packet has been all received.   The rising and falling interrupts do occur and I’ve looked at gpio0 with a scope and it pulsed for 21ms  (high, low) with packed length of about 10 characters, so the waveform seems to be

Working.  However the receive routine below comes up with rxBytes of 0 every time.  Have same problem with encrypted receive routine.  I can put in delay and it will be able to read the bytes, but this should work as is.

Thanks for your help. 

          Receive routine for non encoded packet:

           // Wait for packet received interrupt

            while(!packetSemaphore)

                A=A+1;

 

 

                // Read number of bytes in RX FIFO

                cc120xSpiReadReg(CC120X_NUM_RXBYTES, &rxBytes, 1);

 

                // Check that we have bytes in FIFO

                if(rxBytes != 0)

                {

 

                    // Read MARCSTATE to check for RX FIFO error

                    cc120xSpiReadReg(CC120X_MARCSTATE, &marcState, 1);

 

                    //Mask out MARCSTATE bits and check if have RX FIFO ERR

                    if((marcState & 0x1F) == 0x11)    //RX_FIFO_ERROR

                    {

                        // Flush RX FIFO

                        trxSpiCmdStrobe(CC120X_SFRX);

                    } else

                    {

                        // Read n bytes from RX FIFO

                        cc120xSpiReadRxFifo(rxBuffer, rxBytes);

 

                        // Check CRC ok (CRC_OK: bit7 in second status byte)

                        // This assumes status bytes are appended in RX_FIFO

                        // (PKT_CFG1.APPEND_STATUS = 1)

                        // If CRC is disabled the CRC_OK field will read 1

                        If(rxBuffer[rxBytes-1] & 0x80)

                        {

                            // Update packet counter

                            packetCounter++;

                        }

                    }

 

                // Reset packet semaphore

                packetSemaphore = ISR_IDLE;

 

                // Set radio back in RX

                trxSpiCmdStrobe(CC120X_SRX);

 

        }                             //end of not encrypted receive

 

 

 

 

 

 

 

                                             Config:

 

{CC120X_IOCFG0,            0x06},     //PKT_SYNC_RXTX

  {CC120X_SYNC3,             0x55},    //DualSync

  {CC120X_SYNC2,             0x59},    //These 2 syncs are used  for receive only.  Transmit sync is set prior to tx.

  {CC120X_SYNC1,             0x56},    //

  {CC120X_SYNC0,             0xa6},    //

  {CC120X_SYNC_CFG0,         0x03},    //**was 88.  added PQT_EN=80 & PQT_Gating_En=0x08,b00= most strict. b10=strict_sync_check=3

  {CC120X_SYNC_CFG1,         0x28},    //**28=11 bits & 8 thresh.  was 48.  4x=16bits, 8x=24bits, Ax=32 bits 7-5 len sync, 4:0=sync thresh

  {CC120X_DEVIATION_M,       0x8D},

  {CC120X_MODCFG_DEV_E,      0x08},     //08 for GFSK, 28 for 4GFSK                                         GFSK/4FSK

  {CC120X_DCFILT_CFG,        0x5D},

  {CC120X_PREAMBLE_CFG1,     0x14},     //14=3bytes, 18=4b. 20=6b 10=2bytes e AA.  was 24.  0x31=24bytes. 0x25=7bytes

  {CC120X_PREAMBLE_CFG0,     0xb9},     //**was 8A PQT_EN=08

  {CC120X_IQIC,              0xCB},

  {CC120X_CHAN_BW,           0xA6},     //AC=9.46khz.  AA=10khz

  {CC120X_MDMCFG1,           0x40},     //was E0. 80=carrier sense gate, 40=fifo en, Man mode=20, invert data=10

  {CC120X_MDMCFG0,           0x05},

  {CC120X_SYMBOL_RATE2,      0x5F},     //4f for normal 2400= 5f, 4800=6f or 9600 w/o manchester

  {CC120X_SYMBOL_RATE1,      0x75},

  {CC120X_SYMBOL_RATE0,      0x10},

  {CC120X_AGC_REF,           0x31},

  {CC120X_AGC_CS_THR,        0x8B},     //8B=-117, 8C=-116, 8d=-115 8A=-118,88=-120 was 8a, 92=-110dbm. 8F=-113, A6=-90dbm

  {CC120X_AGC_CFG1,          0x40},

  {CC120X_AGC_GAIN_ADJUST,   0x9c},     //9C=-100, 9D=-99.  This is the RSSI offset valid when AGC_GAIN_ADJUST.GAIN_ADJUSTMENT = 0x00.

  {CC120X_AGC_CFG0,          0x8C},     //8c=5 counts.  Was 80=1 count for rssi

  {CC120X_FIFO_CFG,          0x00},

  {CC120X_SETTLING_CFG,      0x03},

  {CC120X_FS_CFG,            0x1B},

  {CC120X_WOR_CFG0,          0x08},     //same

  {CC120X_WOR_CFG1,          0x08},     //added

  {CC120X_WOR_EVENT0_MSB,    0x01},     //0035=.6pre, 010A=1pre, 018f= 2pre, 0214=2.5pre,  029a=3pre

  {CC120X_WOR_EVENT0_LSB,    0x8f},     //

  {CC120X_PKT_CFG2,          0x00},      //0c=cca mode. CRc disabled, no status byte

  //{CC120X_PKT_CFG1,          0x03},      //def=3, 0x01=append status. 20,10=Adx chk. 02(init ffff) and 04(init 0000) =crc enabled.

  {CC120X_PKT_CFG0,          0x20},      //fixed length=00 in bits 6:5, bit len in bits 4:2

  //{CC120X_RFEND_CFG1,        0x30},    // x30 gives return to rx after rxing

  {CC120X_RFEND_CFG0,        0x04},      //04:RX termination based on PQT.  0x1: Rx term based on CS.  0x30 gives return to rx after txing

  {CC120X_PKT_LEN,           0x7d},      //Maximum packet length

  {CC120X_IF_MIX_CFG,        0x1C},

  {CC120X_FREQOFF_CFG,       0x22},      //FOC_EN=x20, FOC_KI_Factor=02 was 20

  {CC120X_MDMCFG2,           0x00},

  {CC120X_TOC_CFG,           0x4b},     //** was 40 TOC limit 2%

 

  {CC120X_SETTLING_CFG,      0x08},     //Cal FS going from idle to rec or tx

 

  {CC120X_FREQ2,             0x5A},

  {CC120X_FREQ1,             0x00},

  {CC120X_FREQ0,             0x00},

 

  {CC120X_IF_ADC1,           0xEE},

  {CC120X_IF_ADC0,           0x10},

  {CC120X_FS_DIG1,           0x07},

  {CC120X_FS_DIG0,           0xAF},

  {CC120X_FS_CAL1,           0x40},

  {CC120X_FS_CAL0,           0x0E},

  {CC120X_FS_DIVTWO,         0x03},

  {CC120X_FS_DSM0,           0x33},

  {CC120X_FS_DVC0,           0x17},

  {CC120X_FS_PFD,            0x00},

  {CC120X_FS_PRE,            0x6E},

  {CC120X_FS_REG_DIV_CML,    0x1C},

  {CC120X_FS_SPARE,          0xAC},

  {CC120X_FS_VCO0,           0xB5},

  //{CC120X_FS_CFG,            0x0B},                     //136-160Mhz

  {CC120X_XOSC5,             0x0E},

  {CC120X_XOSC1,             0x03},

};

  • If the interrupts occur as expected, I would assume that data is received in the FIFO.

    From your register settings I cannot see that you are using any CRC filtering, meaning that if a packet first is being placed in the FIFO, it should remain there until the FIFO is read or you flushed the FIFO.

    Have you monitored you SPI when you are reading NUM_RXBYTES? Remember that this register is in extended register space.

    I have not been able to verify your settings because there are a lot going on there with RF registers changes from default, WOR settings, RX Termination Based on PQT etc.

    Have you tried to just use default settings from SmartRF Studio (select wanted frequency and data rate in SmartRF Studio), and then verified that you can receive packets with these settings? (Do not use WOR etc. just simple RX and TX)

    Once you have verified that this work, you can change the RF parameters one by one to see that the changes does not break anything, and then you can start enabling the special features.

    Doing it this way, it will be easier to figure our what exactly causes the problems you are seeing.

  • Thanks, Siri:

        I’m using GPIO0 for the radio interrupts but the examples use Gpio2. Would you mind to look at my interrupts, please.

     

     

    //Gpio0 is wired into p1.2 and P7.1.  P1.2 catches gpio0’s rising edge and P7.1 //catches the falling edge.

    #pragma vector=PORT1_VECTOR

    __interrupt void radioRxISR(void)  //irqs for GPIO0 rising edge Rx interrupt

     {

     

        if( (P1IFG & BIT2)==BIT2)       //P1.2 irq

        {

            if((uFixedMode == RxMode) && (RxCald) && ( !RecIrqRunning))  //RxMode=2.  make sure rx has been cal'd and rx isn't already running!

            {

               RecIrqRunning =1; //set rec packet semaphore. rising edge, sync sent. 

               RunRx();              //start receiving

            }

            P1IFG &= ~BIT2;         //clear interrupt flag for P1.2 (GPIO0)

     }

     

     

    //Gpio0 is also connected to P7.1 which catches its negative falling edge:

     

    #pragma vector=PORT7_VECTOR      //falling edge irq on P7.1 to catch GPIO0 going low

    __interrupt void radioTxISR(void)  //irqs for GPIO0 and GPIO2 MISO, MOSI, SCLK port1

    {

            P7IFG &= ~BIT1;         //clear interrupt flag for P7.1 (connected to GPIO0)

            if (uFixedMode == TxMode)              //TxMode =1

            {

                packetSemaphore = TISR_ACTION_REQUIRED; //set transmit semaphore (falling edge, packet sent)

            }

    }

     

     

     

        // Radio interrupts are set up as follows:

        // Connect ISR function to GPIO0 P1.2:

        P1SEL0 &= ~BIT2;          //select GPIO for P1.2

        P1SEL1 &= ~BIT2;

        P1DIR &= ~BIT2;          //set dir to input

        //P1REN |= (BIT2) ;       //pullup

        P1IES &= ~BIT2;          //Rising edge 0->1 gives sync rec'd irq (receive)

        P1IFG &= ~BIT2;          //clear interrupt flag for P1.2

        P1IE |= (BIT2) ;        //ie enable flag

        P1IFG =0;               //clear all irq flags for P1

     

        // connect ISR function to GPIO0 P7.1:

        P7SEL0 &= ~BIT1;        //select GPIO for P7.1

        P7SEL1 &= ~BIT1;

        P7DIR &= ~BIT1;         //set dir to input

        P7IES |= BIT1;          //falling edge

        P7IFG =0;               //clear all interrupt flags for P7

        P7IE |= BIT1;           //ie tx irq enable flag

     

     

     

    John

  • I cannot review your MCU implementation for the interrupt. First of all, I do not even know what MCU you are using, and second, if you are using an MCU from TI you will need to ask this question in the proper forum (If you are using an MSP, you need to ask in the MSP forum), as I am only familiar with the RF devices supported by this forum

    In addition to monitor the SPI and do all the testing I advised you to do in the last post, there are some simple teste you can do to check you interrupt.

    The first thing you need to verify is that you enter the ISR when you get a falling edge on GPIO0 (packet received).

    If you do not do that, there is something wrong with how you have set up the interrupt and/or the pin connected to GPIO0.

    If you are not using length filtering, address filtering, or autoflushing of the FIFO on CRC error,

    reading CC120X_NUM_RXBYTES in the ISR should show you that there are data in the RX FIFO.

    Siri

  • I've done these basic tests but will try to do them better.   Using an MSP430FR5994.  The behavior is that it seems to always receive the rising edge irq of gpio0.  I can receive the whole packet every time by then giving time to receive all the bytes.  But the bytes aren't ready when the falling edge of gpio0 arrives.

  • If IOCFG0 = 0x06, the complete packet is present in the RX FIFO when GPIO0 is de-asserted.

    There is not added anything to the FIFO after that. If you read NUM_RXRBYTES after that it will either be 0 (if you use some kind of filtering and the packet has been filtered away) or it will tell you how many bytes have been received in the packet (including length byte and optional status bytes).

    I do not understand why your code have an interrupt at a rising edge of this signal? Why do you want to know when a sync word has been sent and/or received

    Siri

  • Thanks, Siri:

         The rising edge of the gpio0 is used to tell the transmitter it is time to send the packet.  But I found that it can also be used to receive after waiting to receive all the packets.  This works every time but when falling edge gpio is used, there is no data available in my system.

    John

  • I am sorry but I am not sure what you mean. You should not wait for a rising interrupt on the transmitter before you start writing to the TXFIFO. You should write to the TX FIFO and then Strobe STX, and the only signal you need to care about after that is a falling edge on GPIO0, telling you that the packet has been sent, your TX FIFO is empty and the radio is back in IDLE state (if you test with recommended settings from STudio, as I suggested).

    On the RX side, the only thing you should do  is wait for falling edge on GPIO0, Check that there are bytes in the FIFO (it will be unless you are using filtering), and then read those bytes.

    For me to help you further you need to do the tests I have asked you to and then provide me the results:

    Use recommended settings from SmartRF Studio

    Make sure IOCFG0 = 0x06

    Init the MCU and radio and strobe SRX

    Transmit a packet (you can use SmartRF Studio for simplicity)

    Verify that you are getting an interrupt in your code on falling edge of GPIO0

    Provide me with SPI plots of when you read the NUM_RXBYTES regsiter after the interrupt has occured

    Siri

  • Thanks, Siri:

        I've been sick but will do this as soon as possible.

    John