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.

CCA in cc1120 for LBT

Other Parts Discussed in Thread: CC1120

Hi,

I am working with the CC1120 and the TrxEB and I am trying to implement LBT in my code and it doesn't work, i've been reading the documentation of the cc1120 and the forum. I read a several posts about this and I've seen that i have a problem similar to this: http://e2e.ti.com/support/wireless_connectivity/f/156/t/194568.aspx
but i don't understand everything, for instance, do i need an ISR for the TXONCCA_DONE interrupt? or it is not necessary, right now, i check the TXONCCA_FAILED signal and it doesn't goes to 1 never. I am jamming with another RF module to occupy the channel but my code sends the packet anyway. i put the SYNC_THR to 0x02 to force a stricter synchronization but it doesn't work either.

I attached the code. Please let me know what am i missing because i really don't know what i am doing wrong.
Thank you very much in advance.

  • Hi

    I think you need to take one step back and make a much simpler test to check  the LBT feature. What you can do is to use our EasyLink example for the transmitter.

    After configuring the radio in the main() routine you simply enable LBT and set the desired threshold:

    registerConfig();

    // Enable LBT and set RSSI threshold to -90 dBm

    writeByte = 0x10; cc112xSpiWriteReg(CC112X_PKT_CFG2, &writeByte, 1);

    writeByte = 12; cc112xSpiWriteReg(CC112X_AGC_CS_THR, &writeByte, 1);

    In the transmit loop you simply needs to add four lines of code:

    // Continiously sent packets until button is pressed

    do {

      // Update packet counter

      packetCounter++;

      // Create a random packet with PKTLEN + 2 byte packet counter + n x random bytes

      createPacket(txBuffer);

     // Write packet to TX FIFO

      cc112xSpiWriteTxFifo(txBuffer, sizeof(txBuffer));

      // Strobe RX

      trxSpiCmdStrobe(CC112X_SRX);

      // Wait for RSSI to be valid

      do {

        cc112xSpiReadReg(CC112X_RSSI0, &rssi, 1);

      } while (!(rssi & 0x01));

      // Strobe TX to send packet

      trxSpiCmdStrobe(CC112X_STX);

      // Wait for interrupt that packet has been sent.

      // (Assumes the GPIO connected to the radioRxTxISR function is

      // set to GPIOx_CFG = 0x06)

      while(packetSemaphore != ISR_ACTION_REQUIRED);

      // Clear semaphore flag

      packetSemaphore = ISR_IDLE;

      // Update LCD

      updateLcd();

      //Wait for a random amount of time between each packet

      waitMs(3*(rand()%10+3));

    } while (!bspKeyPushed(BSP_KEY_ALL));

     

    You can then use the RF Device command window in SmartRF Studio and control a jammer by strobing STX (start jammer) and SIDLE (stop jammer). What you will see is that when the jammer is of the transmitter transmits packets while the jammer is on no packets are transmitted.

    BR

    Siri

  • Hello Siri,

    Thanks for the answer it is really helpful, actually now it is working. It stops transmitting when the channel is busy but when the channel is free again (jammer stopped, i am using another board in continuous tx to get busy the channel) it doesn't send again any packet, and the TXONCCA_FAILED signal stays in 1 forever, i have to load the programm again to send packets again. I tried to write in MARC_STATUS_0 this 0x00 before read it and it still changes to 1 the TXONCCA_FAILED, i know it is not necessary to do this but i am using it to check if the channel is busy or is not, the signal stucks in busy after being busy once and it stucks in the loop that checks the signal, it is like the flag stays in 1, i don't know why it stays in 1 but  it doesn't send again when the channel is free after being busy. If i don't check the TXONCCA_FAILED it stucks in the  while(sent != 1); (equivalent to while(packetSemaphore != ISR_ACTION_REQUIRED); )

    I attach the code for helping you to help me :)


    Thank you in advance.

  • I would like to know if there is anyway to read the registers that are in the capture that is attached, because i would like to check the CCA_STATUS and the TXONCCA_DONE. And when the programm detects that the channel is busy where will it stuck? would it be in the TX strobe command  line?

    Thank you.

  • Hi

    I am not sure I understand what you are trying to accomplish in your code and why you have not followed the code example I sent you. When using LBT you should only issue the STX strobe once (sometimes after the RSSI_VALID flag has been asserted). If the channel I free the packet will be transmitted, if not the radio will automatically try again after a delay defined by the ETSI LBT spec.

    In your code you are strobing STX over and over again, and this should not be done. Please implement the code I sent you and you will see that LBT works as specified.

    BR

    Siri

  • Hello Siri,

    Thanks for the reply again.

    I implemented the code that you sent to me, is attached now, and the program stucks in the line while(packetSemaphore != ISR_ACTION_REQUIRED);  after 33 packets as it shows in the LCD if the channel is busy since the beginning of the transmission, and it doesn't sends again any packet when the channel is free again. If it is transmitting and i start the jammer, it stops after transmit 33 packets since the jammer started (it is always 33 packets) and it stucks in the same line and it doesn't sends again after stop the jammer (channel free).

    Can you please tell me why it doesn't work? why is it always 33 packets? and i would like to know as well how can i use the jammer with the smart RF, tell me exactly how to do it, please, because i tried to connect one board and I go to the command tab and click in the STX button but nothing happens.

    Thank you in advance.

  • Hi

    When using the SmartRF Studio as jammer you simply select the same frequency that your transmitter is operating on and selects the “RF Device Command” tab. You press SCAL and then STX and the radio will now transmit preamble. To stop the jammer you simply press SIDLE.

    I have run the code myself and have seen the transmitter stops working if it received a packet while in RX mode checking if the channel is busy or not. The radio enters TXFIFO_ERROR state and is not able to transmit again before the TXFIFO is flushed properly. I have not been able to figure out why this is happening and will need to talk to the designer of the CCA algorithm to figure this out. Due to vacation time this will not happen in the first coming weeks. As a work-around I recommend you to set the SYNC_THR to 0 while checking the channel. This way the radio will never find a sync word and receive data. Just remember to set the threshold back to its original value when you want to receive something.

    BR

    Siri

  • Ok, Thank you again for the reply Siri.

    Please let me know something when the designer is available.

    thanks

  • Hi,

    The problem you are getting is because you receive an interrupt when the radio receive a package. The code sees this as packet sent and restarts the while loop. This in turn strobes RX while the radio has only sent some parts of the data it was supposed to. Which, the next time TX start will result in TX_UNDERFLOW, because the fifo pointers were moved the first time TX was started and then there is a mismatch between the length byte in the beginning of the package and the NUM_TXBYTES register.

    As a workaround you can check what caused the interrupt by reading the MARC_STATUS1 register and check if it was caused by RX finished successfully.
    If it was, flush fifo and exit interrupt and wait for the correct one.

    Example of changed ISR:

    static void radioTxISR(void) {
    //Read MARC_STATUS1 register
    cc112xSpiReadReg(CC112X_MARC_STATUS1, &statusByte, 1);
    //Check if the interrupt was caused by (0x80 - RX finished successfully (a packet is in the RX FIFO ready to be read))
    if(statusByte &= 0x80) {
    //Flush fifo
    trxSpiCmdStrobe(CC112X_SFRX);
    } else {
    // Set packet semaphore
    packetSemaphore = ISR_ACTION_REQUIRED;
    
    // Clear ISR flag
    ioPinIntClear(IO_PIN_PORT_1, GPIO2);
    }
    
    }

  • Hello

    I´m implementing LBT in my project and I have the same issue.

    When I introduce a jammer, it works fine, but when the jammer is a "valid format" signal (another cc1120 transmitting a message for other cc1120, with same sync_word, etc), it doesn´t transmit anything.

    I tried to set SYNC_THR to 0, flush rx fifo when a succesfully reception, and I´m not able to transmit anything.

    Any news?

    Thank you

  • Hi

    If SYNC_THR is 0 you will never receive a packet. If you are not able to transmit anything this must be because the signal in the channel is stronger than the threshold you have programmed for CS. Try to set the threshold lower and see if this helps.

    BR

    Siri

  • Siri said:

    Hi

    I think you need to take one step back and make a much simpler test to check  the LBT feature. What you can do is to use our EasyLink example for the transmitter.

    After configuring the radio in the main() routine you simply enable LBT and set the desired threshold:

    registerConfig();

    // Enable LBT and set RSSI threshold to -90 dBm

    writeByte = 0x10; cc112xSpiWriteReg(CC112X_PKT_CFG2, &writeByte, 1);

    writeByte = 12; cc112xSpiWriteReg(CC112X_AGC_CS_THR, &writeByte, 1);

    In the transmit loop you simply needs to add four lines of code:

    // Continiously sent packets until button is pressed

    do {

      // Update packet counter

      packetCounter++;

      // Create a random packet with PKTLEN + 2 byte packet counter + n x random bytes

      createPacket(txBuffer);

     // Write packet to TX FIFO

      cc112xSpiWriteTxFifo(txBuffer, sizeof(txBuffer));

      // Strobe RX

      trxSpiCmdStrobe(CC112X_SRX);

      // Wait for RSSI to be valid

      do {

        cc112xSpiReadReg(CC112X_RSSI0, &rssi, 1);

      } while (!(rssi & 0x01));

      // Strobe TX to send packet

      trxSpiCmdStrobe(CC112X_STX);

      // Wait for interrupt that packet has been sent.

      // (Assumes the GPIO connected to the radioRxTxISR function is

      // set to GPIOx_CFG = 0x06)

      while(packetSemaphore != ISR_ACTION_REQUIRED);

      // Clear semaphore flag

      packetSemaphore = ISR_IDLE;

      // Update LCD

      updateLcd();

      //Wait for a random amount of time between each packet

      waitMs(3*(rand()%10+3));

    } while (!bspKeyPushed(BSP_KEY_ALL));

     

    You can then use the RF Device command window in SmartRF Studio and control a jammer by strobing STX (start jammer) and SIDLE (stop jammer). What you will see is that when the jammer is of the transmitter transmits packets while the jammer is on no packets are transmitted.

    BR

    Siri

    Hi Siri,

    I've one doubt on the above code. Can you please clarify?

    // writeByte = 12; cc112xSpiWriteReg(CC112X_AGC_CS_THR, &writeByte, 1);

    What does that 12(0x0C) indicates?

    thanks in advance.

    regrads

    Vinoth M.

  • Hi

    It sets the AGC carrier sense threshold to -90 dBm.

    The number is two's complement number with 1 dB resolution and the offset is 102 dB.

    BR

    Siri

     

  • thanks for your response.

    Is there any maximum retention time for FREQ2, FREQ1 and FREQ0 registers?
    Can you please tell me?

    regards
    Vinoth M.
  • Hi

    Can you help me to solve CCA problem in CC1125.

    I'm trying to test LBT feature of CC1125. I have three transceiver, One is TrxEB act as a jammer(TX only), and the remainging two are custom boards. All are on the same carrier frequency.

    I configured the LBT associated registers AGC_CS_THR = 0x2A(carrier sense -80 dBm threshold) and PKT_CFG2 = 0x10 (PKT_CFG2.CCA_MODE = 4).
    I'm transmitting continously from TrxEB(to occupy the channel). I observed on my custom board and getting zero from MARC_STATUS0 register and  sometimes it is giving 0x12(18), 0x1A(26), 0x10(16), 0x2E(46), 0x30(48).


    What could be the reason that CHANNEL BUSY flag is not set?

    I did the following steps.

    1.Strobing SRX
    2.Checking whether RSSI valid or not
    3.Monitoring MARC_STATUS0 register

    (I'm not transmitting from my custom board. Just observing whether the channel is BUSY or not)

    Is this correct way to test LBT? 
    Please guide me do the test?

    thanks in advance.
    regards
    Vinoth M.

  • Hi Siri,

    Thanks for your response.

    I'm using CCA interrupt(GPIO3 = 0x0F) and Packet TX/RX Interrupt(GPIO2 = 0x06).

    I observed both GPIO3 and GPIO0 pins are in High state only Whenever the packet is receiving that time only it is going to Low state.

    What could be the problem? Let me know if any modification is require.

    regards,

    Vinoth M.