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.

Modify CC1010 SPP example code to handle a external tx/rx switch by GPIO.

Other Parts Discussed in Thread: CC1010

Hi, i am working with the old ic CC1010. I am trying to develop a UART transmitter by the air, in transparent mode.

I find in the examples, a project named "RF232", which uses the Simple Packet Protocol (SPP) to do that, and it work very well.

My problem is i have a power amplifier in the output of CC1010, with a TX/RX switch, which switches the antenna between tx and rx pins. So, i have to handle it with a digital pin of CC1010 every time i transmit a packet o receive a packet. 

The main code of program is here:

while (TRUE) {
        
        // Receive a packet
        if (sppReceive(&RXI) == SPP_RX_STARTED) {

            // Wait for RF RX to complete
            do {
                if (txRequest && (TXI.status == SPP_TX_FINISHED) && (RXI.status == SPP_RX_WAITING)) {
                    sppReset();
                }
            } while (SPP_STATUS() != SPP_IDLE_MODE); 

            // Check the results (ignore retransmitted messages)
            if (RXI.status == SPP_RX_FINISHED) {
                if (SPP_SEQUENCE_BIT & (lastRXflags ^ RXI.flags)) {

                    // Wait for UART TX to complete 
                    while (uartRXPos != rxDataLen[uartRXBuffer]);
                                                                            //
                    // Only process packets with payload data               //
                    if ((rxDataLen[rfRXBuffer] = RXI.dataLen) != 0) {       //
                                                                            //
                        // Switch buffers and initiate UART0 transmission	// No UART TX interrupts in this section
                        GLED = ~GLED;                                       //
                        SWITCH(uartRXBuffer, rfRXBuffer);                   //
                        RXI.pDataBuffer = pRXBuffer[rfRXBuffer];            //
                        uartRXPos = 0;                                      //
                        UART0_SEND(pRXBuffer[uartRXBuffer][uartRXPos]);
                    }
                }
                lastRXflags = RXI.flags;
            }
        }

        // Transmit packet, if requested
        if (txRequest) {
            if (sppSend(&TXI) == SPP_TX_STARTED) {

                // Wait for the transmission to finish
              //  YLED = LED_ON;
                while (SPP_STATUS() != SPP_IDLE_MODE);
              //9  YLED = LED_OFF;

                // Check out the results
                if (TXI.status == SPP_TX_FINISHED) {
                    sppSettings.rxTimeout = NORMAL_TIMEOUT;
                    RLED = LED_OFF;
                    txRequest = TX_REQUEST_OFF;
                } else {
                    RLED = LED_ON;
                    sppSettings.rxTimeout = RETRY_TX_TIMEOUT;
                }
            }
        }

        // Recalibrate the transceiver if requested to
        if (recalibRequest) {
            sppSetupRF(&RF_SETTINGS, &RF_CALDATA, TRUE);
        }
    }
} // main




//----------------------------------------------------------------------------
//  Start transmission (called by TIMER3_ISR(), in sppTimer.c)
//----------------------------------------------------------------------------
void startTX() {

    if (!txRequest) {
        SWITCH(uartTXBuffer, rfTXBuffer);
        TXI.pDataBuffer = pTXBuffer[rfTXBuffer];
        TXI.dataLen = uartTXPos;
        uartTXPos = 0;
        UART0_FLOW_CONTROL = READY; BLED = LED_OFF;
        txRequest = TX_REQUEST_ON;
    } else {
        startTXTimeout = SHORT_TX_TIMEOUT;
    }
} // startTX





//----------------------------------------------------------------------------
//  Recalibrate the transceiver (called by TIMER3_ISR(), in sppTimer.c)
//----------------------------------------------------------------------------
void startRecalib (void) {
    recalibRequest = RECALIB_REQUEST_ON;
    recalibTimeout = RECALIB_TIMEOUT;
} // recalibrateRF

I think first only i have to add a "Pinxx = high" (where pinxx is my pin to control tx/rx switch) next to "if (txRequest)" line, but the program send ack packets too in other site (i do not know where, i do not really understand the code very well), and i need activate the xxpin every time the cc1010 is transmitting power (this is equal to say, every time the CC1010 have its PA (power amplifier) on), regardless if they are data packets or ack packets, or whatever. The code uses several libraries and i not sure at what point the CC1010 is transmitting power or not.

Please, how I should modify the code to achieve that purpose? Or, where can i learn about the SPP protocol to understand this code? i do not find information in the web about that.

And another question: Looking in a spectrum analyzer, i see the CC1010 with this example, transmit like a Frequency Hopping protocol (i see peaks of power in different frequency every time). Is true? How can i modify the code to transmit on a single frequency?

Thanks in advance for your help.

BR.

Darío.