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.

CC1101 issue with going into receive mode (idle instead of receive mode)

Other Parts Discussed in Thread: SIMPLICITI

SimpliciTI configuration (first always good)

/* Base frequency = 904.149841 */
/* Modulation format = GFSK */
/* Data rate = 249.939 */
/* Device address = 0 */
/* TX power = 0 */
/* Packet length mode = Variable packet length mode. Packet length configured by the first byte after sync word */
/* Whitening = false */
/* RX filter BW = 541.666667 */
/* Carrier frequency = 904.149841 */
/* Preamble count = 4 */
/* Deviation = 126.953125 */
/* Packet length = 255 */
/* Channel spacing = 231.689453 */
/* Modulated = true */
/* PA ramping = false */
/* Data format = Normal mode */
/* Sync word qualifier mode = 30/32 sync word bits detected */
/* CRC enable = true */
/* Address config = No address check */
/* Channel number = 0 */
/* Manchester enable = false */
/* CRC autoflush = false */
/***************************************************************
 *  SmartRF Studio(tm) Export
 *
 *  Radio register settings specifed with C-code
 *  compatible #define statements.
 *
 *  RF device: CC1101
 *
 ***************************************************************/

#ifndef SMARTRF_CC1101_H
#define SMARTRF_CC1101_H

#define SMARTRF_RADIO_CC1101
#define SMARTRF_SETTING_IOCFG2     0x29
#define SMARTRF_SETTING_IOCFG0     0x06
#define SMARTRF_SETTING_FIFOTHR    0x07
#define SMARTRF_SETTING_PKTLEN     0xFF
#define SMARTRF_SETTING_PKTCTRL1   0x04
#define SMARTRF_SETTING_PKTCTRL0   0x05
#define SMARTRF_SETTING_ADDR       0x00
#define SMARTRF_SETTING_CHANNR     0x00
#define SMARTRF_SETTING_FSCTRL1    0x12
#define SMARTRF_SETTING_FSCTRL0    0x00
#define SMARTRF_SETTING_FREQ2      0x22
#define SMARTRF_SETTING_FREQ1      0xC6
#define SMARTRF_SETTING_FREQ0      0x66
#define SMARTRF_SETTING_MDMCFG4    0x2D
#define SMARTRF_SETTING_MDMCFG3    0x3B
#define SMARTRF_SETTING_MDMCFG2    0x93
#define SMARTRF_SETTING_MDMCFG1    0x23
#define SMARTRF_SETTING_MDMCFG0    0x24
#define SMARTRF_SETTING_DEVIATN    0x62
#define SMARTRF_SETTING_MCSM0      0x18
#define SMARTRF_SETTING_FOCCFG     0x1D
#define SMARTRF_SETTING_BSCFG      0x1C
#define SMARTRF_SETTING_AGCCTRL2   0xC7
#define SMARTRF_SETTING_AGCCTRL1   0x00
#define SMARTRF_SETTING_AGCCTRL0   0xB0
#define SMARTRF_SETTING_WORCTRL    0xFB
#define SMARTRF_SETTING_FREND1     0xB6
#define SMARTRF_SETTING_FREND0     0x10
#define SMARTRF_SETTING_FSCAL3     0xEA
#define SMARTRF_SETTING_FSCAL2     0x2A
#define SMARTRF_SETTING_FSCAL1     0x00
#define SMARTRF_SETTING_FSCAL0     0x1F
#define SMARTRF_SETTING_TEST2      0x88
#define SMARTRF_SETTING_TEST1      0x31
#define SMARTRF_SETTING_TEST0      0x09

#endif

automatic cal is set.

It transistions to CAL then after a bit into IDLE instead. I sample the MARCSTATE at 1ms intervals.

It goes something like CIIIIIIIII

It appears to do a calibration then idles. This would explain why it's not receiving... however what would cause this? Would it be better to calibration AFTER a receive or transmit instead (from idle).

  • Did you ever issue a SRX strobe?

    Regards,
    /TA

  • Indeed code snippets

    			// now for the radio oscillator to wake up
    			//critical_put('s');
    			MRFI_WakeUp();
    			//critical_put(radio_state_symbol());
    			//critical_put(get_ars_state_symbol());
    			// turn on radio to receive
    			//critical_put('r');
    			MRFI_RxOn();
    

    Similar code that does more polled variant

    	if(mrfiRadioState != MRFI_RADIO_STATE_RX)
    	{
    		// now for the radio oscillator to wake up
    		MRFI_WakeUp();
    	#ifdef	USED
    		{
    			uint16_t	state;
    			//uint16_t	delay = 5;
    
    			// check radio tell idle
    			while(( mrfiSpiReadReg(MARCSTATE) != rs_idle)
    				&&(delay))
    			{
    				state = mrfiSpiReadReg(MARCSTATE);
    				delay_ms(1);
    				delay--;
    			}
    		}
    	#endif
    		// turn on radio to receive
    		MRFI_RxOn();
    	}
    

    the latter is how I know the 'Calibrating' then 'Idle' bit.

    Stephen

  • In your second code example you do not issue a SRX, you are checking on IDLE and stay in the loop forever. This version should work fine.


    if(mrfiRadioState != MRFI_RADIO_STATE_RX)
    {
    // now for the radio oscillator to wake up
    MRFI_WakeUp();
    delay_ms(1);
    MRFI_RxOn();


    while(1) {
    state = mrfiSpiReadReg(MARCSTATE);
    delay_ms(1);
    }
    }
  • TA12012 said:
    In your second code example you do not issue a SRX, you are checking on IDLE and stay in the loop forever. This version should work fine.


    if(mrfiRadioState != MRFI_RADIO_STATE_RX)
    {
    // now for the radio oscillator to wake up
    MRFI_WakeUp();
    delay_ms(1);
    MRFI_RxOn();


    while(1) {
    state = mrfiSpiReadReg(MARCSTATE);
    delay_ms(1);
    }
    }

    I should face palm on that one LOL

    AHEM:

    void	network_radio_receive(uint16_t delay)
    {
    	if(mrfiRadioState != MRFI_RADIO_STATE_RX)
    	{
    		// now for the radio oscillator to wake up
    		MRFI_WakeUp();
    	#ifdef	USED
    		{
    			uint16_t	state;
    			//uint16_t	delay = 5;
    
    			// check radio tell idle
    			while(( mrfiSpiReadReg(MARCSTATE) != rs_idle)
    				&&(delay))
    			{
    				state = mrfiSpiReadReg(MARCSTATE);
    				delay_ms(1);
    				delay--;
    			}
    		}
    	#endif
    		// turn on radio to receive
    		MRFI_RxOn();
    	}
    }
    //----------------------------------------------------------------------
    

    delay is counted down (normally it's a value between 5 and 30) so essentially it will wait 30ms tell it reaches the idle state then call MRFI_RxOn();

    I wonder if mrfiSpiReadReg(MARCSTATE); is being optimized out by the compiler

        3466            ;----------------------------------------------------------------------
        3467            ; 1200 | state = mrfiSpiReadReg(MARCSTATE);                                     
        3468            ;----------------------------------------------------------------------
        3469 000012 407C          MOV.B     #53,r12               ; [] |1200| 
             000014 0035 
        3470            $C$DW$250       .dwtag  DW_TAG_TI_branch
        3471                    .dwattr $C$DW$250, DW_AT_low_pc(0x00)
        3472                    .dwattr $C$DW$250, DW_AT_name("mrfiSpiReadReg")
        3473                    .dwattr $C$DW$250, DW_AT_TI_call
        3474 000016 13B0!         CALLA     #mrfiSpiReadReg       ; [] |1200| 
             000018 0000 
        3475                                                      ; [] |1200| 
    

    Apparently it's not being optimized out (hmm), although it is redundant. I think I was using that to test the state in the debugger (hrmm).

    anyhow it isn't an infinate look it is "partially" blocking as some would say it will wait "for a while" then give up and try to go to receive state anyways.

    Stephen