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.

CC1110 RX TX Transition

Other Parts Discussed in Thread: CC2510

Hello,

I'm writing CC1110 software based on
"CC1110_CC2510 Example Software Supported on IAR Embedded Workbench (Rev. B) (swrc085b)"

and what i want to do is,
(1) Let CC1110 device as RX mode when boot up
(2) When CC1110 device receive packet from another peer, transition to TX mode and send response packet to peer
(3) After send packet, transition back to RX mode again

for this purpose, I write function below and make it called whenever CC1110 device receive packet
but seems CC1110 device won't send packet.

I'd check that CC1110 device receive packet with no problem but not able to send packet. So I can say (1), (3) is okay but (2) is not.

Could you check code below and let me know if there's problem?

Thanks in advance!


void PacketSend(void)
{
   UINT8 idx;

   // (1) transition to tx mode and send packet
   mode = RADIO_MODE_TX;
   RFST = STROBE_TX;

   dmaRadioSetup(RADIO_MODE_TX);

   // Configure interrupt for every time a packet is sent
   HAL_INT_ENABLE(INUM_RF, INT_ON);    // Enable RF general interrupt
   RFIM = IRQ_DONE;                    // Mask IRQ_DONE flag only
   INT_GLOBAL_ENABLE(INT_ON);          // Enable interrupts globally

   // Construct the packet to be transmitted in buffer
   radioPktBuffer[0] = PACKET_LENGTH;                  // Length byte
   radioPktBuffer[1] = (BYTE) (NETWORK_ID_KEY>>8);     // Network identifier
   radioPktBuffer[2] = (BYTE) NETWORK_ID_KEY;
   // radioPktBuffer[3:6] = 4 byte packet sequence number, written later
   // Fill rest of payload with dummy data. Radio is using data whitening.
   for (idx = 3; idx <= PACKET_LENGTH; idx++) {
       radioPktBuffer[idx] = 0xCC;
    }        

   RFST = STROBE_IDLE;
   halWait(1);
   RFST = STROBE_CAL;
   halWait(1);
       
   // Send packet 
   DMAARM |= DMAARM_CHANNEL0;  // Arm DMA channel 0
   RFST = STROBE_TX;           // Switch radio to TX

   // Wait until the radio transfer is completed,
   // and then reset pktSentFlag
   while(!pktSentFlag);
      pktSentFlag = FALSE;
   
   // (2) transition to rx
   mode = RADIO_MODE_RX;

   dmaRadioSetup(RADIO_MODE_RX);
       
   // Configure interrupt for every time a packet is sent
   HAL_INT_ENABLE(INUM_RF, INT_ON);    // Enable RF general interrupt
   RFIM = IRQ_DONE;                    // Mask IRQ_DONE flag only
   INT_GLOBAL_ENABLE(INT_ON);          // Enable interrupts globally
       
   RFST = STROBE_IDLE;
   halWait(1);
   RFST = STROBE_CAL;
   halWait(1);

   // Start receiving
   DMAARM = DMAARM_CHANNEL0;           // Arm DMA channel 0       
   RFST   = STROBE_RX;                 // Switch radio to RX   
}

  • Hi
    Please take a look at the example posted here to see how to use the DMA together with the radio for RX and TX operation:
    http://e2e.ti.com/support/wireless_connectivity/f/156/t/341608BRSiri
  • Hello, Siri

    Thanks for your answer.
    Actually I use your code "3513.CC1110.rar" at http://e2e.ti.com/support/wireless_connectivity/f/156/p/16733/1196004#1196004
    and now it works just fine for RX and TX transition
  • Hello, Siri

    While TX/RX transition quite many times while operation,
    my system sometimes halted(it happened really sometimes).

    I guess it's because code stuck at while loop somewhere in my code below.
    Is there way to avoid it like change while loop to other else?

    Thanks in advance!
    Jay

    <TX>
    RFST = SIDLE;
    halWait(1);
    RFST = STX;

    halWait(1);

    if(MARCSTATE == MARC_STATE_TX) // process only if MARCSTATE is TX
    {
    for (uint8 m = 0; m <= 13; m++)
    {
    while (!RFTXRXIF);

    RFTXRXIF = 0;
    RFD = txBuffer[m];
    }
    while ((RFIF & 0x10) == 0); // Wait for IRQ_DONE
    RFIF &= ~0x10;
    RFTXRXIF = 0;
    }

    <RX>
    RFST = SIDLE;
    halWait(1);
    RFST = SRX;

    while (!RFTXRXIF);
    RFTXRXIF = 0;
    length = RFD;
    radioPktBuffer[0] = length;
    for (uint8 j = 1; j <= length + 2; j++)
    {
    while (!RFTXRXIF);
    RFTXRXIF = 0;
    radioPktBuffer[j] = RFD;
    }
  • Hi

    Actually I would strongly recommend that you use the DMA with the radio. That way you do not need to manually poll flags and wait for things to happen. The DMA will take care of the radio and you will get an interrupt when a packet is sent or received.

    When using the polling code you might get problems if you for example get an interrupt and therefore are too late to read/write the RFD register.

    Using the DMA you will not have such problems if your priorities are set up correctly.

    BR

    Siri

  • Hi

    Thank for explanation and I'm starting rewrite the code which use DMA you suggested.

    BR

    Jay