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 asserted only once

Hi, I'm trying to use CCA with CC430 and I can only get the CCA interrupt signal (RFIFG12) asserted once and then for the rest of the time, it will not get asserted again. This problem is resolved when the device is restarted however.

I'm using absolute CS threshold, I'm not sure what's the CS threshold and I don't know how to measure it. I've read on the forums that the CS threshold could be too low that the device is interpreting noise as channel being busy. So I've set everything to highest settings:

/* set threshold high */
max_dvga_gain = 0;
max_lna_gain = 0;
WriteSingleReg(AGCCTRL2, (max_dvga_gain << 6) | (max_lna_gain << 3) | 0x03);
	
/* use absolute threshold instead of relative */
WriteSingleReg(AGCCTRL1, BIT6 | 7); /* AGC_LNA_PRIORITY = 1, 7dB above */

This is the transmit function:

uint8_t phy_transmit(uint8_t *buffer, uint8_t length) {
	phy_disableRX();
	receiving = 0;
	wor = 0;
	transmitting = 1;
	
	uint8_t tx_success = 0;
	
	/* Configuring registers */
	RF1AIFG &= ~(1 << 12);
	RF1AIES |= (1 << 12);	/* CCA asserted when RSSI level is below threshold */
	RF1AIE &= ~(1 << 12);	/* Do not want an interrupt for it */

	/* Configure TX FIFO */
	WriteBurstReg(RF_TXFIFOWR, buffer, length);

	/* Transmit using CCA */
	/* e2e.ti.com/.../implementation-of-cca-in-an-application-cc1100-cc1101-cc1110-cc1111-cc2500-cc2510-cc2511 */

	__no_operation(); /* for debug */
	
	/* 1. Strobe SRX */
	Strobe(RF_SRX);

	/* 2. Wait for RX mode (0x0D or 13 [DEC]) to be entered (poll MARCSTATE) */
	while(ReadSingleReg(MARCSTATE) != 0x0D);

	/* 3. Wait 500us for RSSI to be valid, 6000 cycles with 12MHz clock */
	__delay_cycles(6000);
	
	if(enableUartLog) printf("RSSI: %d dBm", phy_getRSSI());
	/* 3.1 If CCA is asserted, channel is free */
	if(RF1AIFG & (1 << 12)) {
		RF1AIFG &= ~(1 << 12);
		if(enableUartLog) printf(" Channel free ");
		
		/* 4. STrobe STX */
		RF1AIES |= BIT9;
		RF1AIFG &= ~BIT9;
		
		Strobe(RF_STX);
		
		/* 5. Wait for TX to completed sending */
		while(!(RF1AIFG & (1 << 9))); 
		transmitting = 0;
		
		tx_success = 1;
	} else {
		if(enableUartLog) printf(" Channel busy ");
		tx_success = 0;
	}
	return tx_success;
}

Can I please get some help with this problem?

  • Cong Nguyen,

    I recommend using a "RF_SIDLE" command in there to reset the statemachine and get it ready for the next loop (packet).

    Also you are reading the RF1AIFG register directly and multiple times, this is not recommended as the action of you reading it will change the value. Copy the information to a different register and use that instead.

    Regards,
    /TA
  • Finally got it working. It's possibly because I place the strobe TX command after checking for CCA? Once those are swapped around, transmit function works out fine.

    uint8_t phy_transmit(uint8_t *buffer, uint8_t length) {
    	phy_disableRX();
    	receiving = 0;
    	wor = 0;
    	transmitting = 1;
    
    	uint8_t tx_success = 0;
    
    	/* Configuring registers */
    	RF1AIFG &= ~(1 << 12);
    	RF1AIES |= (1 << 12); /* CCA asserted when RSSI level is below threshold */
    	RF1AIE &= ~(1 << 12); /* Do not want an interrupt for it */
    
    	/* Configure TX FIFO */
    	WriteBurstReg(RF_TXFIFOWR, buffer, length);
    
    	/* Transmit using CCA */
    	/* <a href="/support/wireless_connectivity/w/design_notes/implementation-of-cca-in-an-application-cc1100-cc1101-cc1110-cc1111-cc2500-cc2510-cc2511">e2e.ti.com/.../implementation-of-cca-in-an-application-cc1100-cc1101-cc1110-cc1111-cc2500-cc2510-cc2511</a> */
    
    	__no_operation(); /* for debug */
    
    	/* 1. Strobe SRX */
    	Strobe(RF_SRX);
    
    	/* 2. Wait for RX mode (0x0D or 13 [DEC]) to be entered (poll MARCSTATE) */
    	while(ReadSingleReg(MARCSTATE) != 0x0D);
    
    	/* 3. Wait 500us for RSSI to be valid, 6000 cycles with 12MHz clock */
    	__delay_cycles(6000);
    
    	if(enableUartLog) printf("RSSI: %d dBm", phy_getRSSI());
    
    	/* 4. STrobe STX */
    	RF1AIES |= BIT9;
    	RF1AIFG &= ~BIT9;
    	Strobe(RF_STX);
    
    	/* 4.1 If CCA is asserted, channel is free */
    	if(RF1AIFG & (1 << 12)) {
    		RF1AIFG &= ~(1 << 12);
    		if(enableUartLog) printf(" Channel free ");
    
    		/* 5. Wait for TX to completed sending */
    		while(!(RF1AIFG & (1 << 9))); 
    		transmitting = 0;
    
    		tx_success = 1;
    	} else {
    		if(enableUartLog) printf(" Channel busy ");
    		tx_success = 0;
    	}
    
    	Strobe(RF_SFTX); /* flush TX FIFO and put radio into idle mode */
    	return tx_success;
    }