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.

CCS Looses connection with CC2650 after expanding RFC_RAT register bank when RAT has not been started.

Other Parts Discussed in Thread: CC2650

I have a CC2650 that I've been trying to get up and going in proprietary mode. Part of the RF core initialization is turning the RAT on, which involves issuing the CMD_START_RAT command to the RFDBEL.

During single stepping through the code, I expanded the RFC_RAT (under the Registers view) before the RAT was actually started. The text "Error: unable to read" appeared in the "value" column, which is expected. The RAT hasn't been started, which I assume involves applying power to the RAT. If the RAT doesn't have power, then yes, trying to read those memory addresses are going to choke.

After expanding the RFC_RAT, I tried to continue single stepping through the code, it appeared to continue execution (the Pause and Stop buttons were enabled in CCS). Pressing the Pause button resulted in this error message:

Cortex_M3_0: Trouble Halting Target CPU: (Error -2062 @ 0x0) Unable to halt device. Reset the device, and retry the operation. If error persists, confirm configuration, power-cycle the board, and/or try more reliable JTAG settings (e.g. lower TCLK). (Emulation package 6.0.228.0)
This problem appears to be unique to trying to read the RAT when it hasn't been enabled yet. I can expand the I2C0 register bank with it powered off and continue stepping through code just fine.

Is there a configuration setting I need to change so trying to read the RAT registers when the RAT hasn't been started doesn't take down the entire debugging session?

  • Hi,

    I am trying to reproduce this issue here but without success. In my setup I get everything identical to you up to the second paragraph, but neither I can see RFC_RAT registers become active anytime nor I get a CPU halt with their tree expanded. The applications I loaded (SimpleAP, SimpleBLEPeripheral) seem to work just fine - although I couldn't get to a point in the code where the RFC_RAT register was in fact active.

    Perhaps this may be tied to the application you are running? In this case, I would strongly recommend you to check with the experts in the BLE forum.

    Regards,
    Rafael
  • I just loaded up SimpleBLEPeripheral and got the same results as you.  

    I was trying to bare-metal program the CC2650  Here's the complete code listing.  Apologies for the messy code.  It's been a lot of trial and error.

    #include <stdio.h>
    #include <stdlib.h>
    #include <stdint.h>
    #include <stdbool.h>
    #include <inc/hw_memmap.h>
    #include <inc/hw_types.h>
    #include <inc/hw_prcm.h>
    #include <inc/hw_fcfg1.h>
    #include <inc/hw_rfc_pwr.h>
    #include <inc/hw_aon_rtc.h>
    #include <driverlib/chipinfo.h>
    #include <driverlib/rfc.h>
    #include <driverlib/rf_common_cmd.h>
    #include <driverlib/rf_prop_cmd.h>
    #include <driverlib/rf_data_entry.h>
    #include <driverlib/pwr_ctrl.h>
    #include <driverlib/ddi.h>
    #include <driverlib/aon_rtc.h>
    #include <driverlib/prcm.h>
    #include <driverlib/osc.h>
    #include <driverlib/ccfgread.h>
    #include <driverlib/chipinfo.h>
    
    void SetupCommandForImmediateExecution(struct rfc_radioOp_s *setMeUp, uint16_t commandNo)
    {
    	setMeUp->commandNo = commandNo;
    	setMeUp->status = 0x0000;
    	setMeUp->pNextOp = 0x00000000;
    	setMeUp->startTime = 0x00000000;
    	setMeUp->startTrigger.triggerType = TRIG_NOW;
    	setMeUp->startTrigger.triggerNo = 0;
    	setMeUp->startTrigger.bEnaCmd = 0;
    	setMeUp->startTrigger.pastTrig = 0;
    	setMeUp->condition.rule = COND_NEVER;
    	setMeUp->condition.nSkip = 0;
    }
    
    void SwitchToExternalOsc()
    {
    	OSCInterfaceEnable();
    	OSCClockSourceSet(OSC_SRC_CLK_HF, OSC_XOSC_HF);
    	OSCClockSourceSet(OSC_SRC_CLK_LF, OSC_XOSC_LF);
    	while(!OSCHfSourceReady()){}
    }
    
    void EnableRfCore()
    {
    	uint32_t supportedRadioModes = ChipInfo_GetSupportedProtocol_BV();
    	HWREG(PRCM_BASE + PRCM_O_RFCMODESEL) = 0x05; //Proprietary and BLE.  TI does not have have good documentation on this.
    	HWREG(AON_RTC_BASE + AON_RTC_O_CTL) = AON_RTC_CTL_EN | AON_RTC_CTL_RTC_UPD_EN;
    	PRCMPowerDomainOn(PRCM_DOMAIN_RFCORE);
    	while(PRCMPowerDomainStatus(PRCM_DOMAIN_RFCORE) != PRCM_DOMAIN_POWER_ON){}
    	RFCClockEnable();
    }
    
    void SetupRadioNonProprietary() {
    
    	struct rfc_CMD_RADIO_SETUP_s radioSetup;
    	radioSetup.commandNo = CMD_RADIO_SETUP;
    	radioSetup.status = 0x0000;
    	radioSetup.pNextOp = 0x00000000;
    	radioSetup.startTime = 0x00000000;
    	radioSetup.startTrigger.bEnaCmd = 0;
    	radioSetup.startTrigger.triggerType = TRIG_NOW;
    	radioSetup.startTrigger.triggerNo = 0;
    	radioSetup.startTrigger.pastTrig = 0;
    	radioSetup.condition.rule = COND_NEVER;
    	radioSetup.condition.nSkip = 0;
    	radioSetup.mode = 0x00;
    	radioSetup.__dummy0 = 0x00;
    	radioSetup.config.frontEndMode = 0x0;
    	radioSetup.config.biasMode = 0x0;
    	radioSetup.config.bNoFsPowerUp = 0x0;
    	radioSetup.txPower.IB = 0x21;
    	radioSetup.txPower.GC = 0x1;
    	radioSetup.txPower.tempCoeff = 0x31;
    	radioSetup.pRegOverride = 0x00000000;
    	HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = (uint32_t)&radioSetup;
    	while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {}
    
    	struct rfc_CMD_FS_POWERUP_s powerUp;
    	powerUp.commandNo = CMD_FS_POWERUP;
    	powerUp.status = 0x0000;
    	powerUp.pNextOp = 0x00000000;
    	powerUp.startTime = 0x00000000;
    	powerUp.startTrigger.bEnaCmd = 0;
    	powerUp.startTrigger.triggerType = TRIG_NOW;
    	powerUp.startTrigger.triggerNo = 0;
    	powerUp.startTrigger.pastTrig = 0;
    	powerUp.condition.rule = COND_NEVER;
    	powerUp.condition.nSkip = 0;
    	powerUp.pRegOverride = 0x00000000;
    	HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = (uint32_t)&powerUp;
    	while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {}
    	struct rfc_CMD_SYNC_START_RAT_s startRat;
    	startRat.commandNo = 0x080A;
    	startRat.startTrigger.triggerType = TRIG_NOW;
    	startRat.condition.rule = COND_NEVER;
    	startRat.rat0 = 0;
    	HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = (uint32_t)&startRat;
    		while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {
    		}
    	struct rfc_CMD_FS_s freqSynth;
    	freqSynth.commandNo = CMD_FS;
    	freqSynth.startTrigger.triggerType = TRIG_NOW;
    	freqSynth.condition.rule = COND_NEVER;
    	freqSynth.frequency = 2402; //LL channel 37.
    	freqSynth.fractFreq = 0;
    	freqSynth.synthConf.bTxMode = 1;
    	HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = (uint32_t)&freqSynth;
    	while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {}
    }
    
    uint32_t cmdStat ;
    void SendCommand(rfc_radioOp_t *sendMe)
    {
    	HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = (uint32_t)sendMe;
    	while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {}
    
    	bool statusGood = false;
    	while(!statusGood)
    	{
    		if (sendMe->status == 0x0400)
    			statusGood = true;
    		if (sendMe->status == 0x3400)
    			statusGood = true;
    	}
    	while( HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA) !=1){}
    }
    
    
    
    int main(void) {
    	SwitchToExternalOsc();
    	EnableRfCore();
    
    	//SetupRadioNonProprietary();
    
    	struct rfc_CMD_PROP_RADIO_SETUP_s radioSetup;
    	SetupCommandForImmediateExecution(&radioSetup, CMD_PROP_RADIO_SETUP);
    	radioSetup.modulation.modType = 1; //GFSK;
    	radioSetup.modulation.deviation = 1000; //1000 * 250hz =  250khz deviation
    	radioSetup.symbolRate.preScale = 4; //setup the symbol rate for 1Mps  See 23.7.5.2
    	radioSetup.symbolRate.rateWord = 1525603;
    	radioSetup.rxBw = 12; //RX bandwidth of 1060khz
    	radioSetup.preamConf.nPreamBytes = 2; //2 preamble bytes
    	radioSetup.preamConf.preamMode = 0; //Send 0 as the first byte of the preamble.
    	radioSetup.formatConf.nSwBits = 32; //32 bit sync word
    	radioSetup.formatConf.bBitReversal = 0;
    	radioSetup.formatConf.bMsbFirst = 1;
    	radioSetup.formatConf.fecMode = 0;
    	radioSetup.formatConf.whitenMode = 0;
    	radioSetup.config.frontEndMode = 0;
    	radioSetup.config.biasMode = 0;
    	radioSetup.config.bNoFsPowerUp = 0; //power up the frequency synth
    	radioSetup.txPower = 0x3161;
    	radioSetup.pRegOverride = 0x000000000;
    	SendCommand(&radioSetup);
    
    	rfc_CMD_SYNC_START_RAT_t startRat;
    	SetupCommandForImmediateExecution(&startRat, CMD_SYNC_START_RAT);
    	SendCommand(&startRat);
    	//HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = &startRat;
    
    	struct rfc_CMD_FS_s freqSynth;
    	SetupCommandForImmediateExecution(&freqSynth, CMD_FS);
    	freqSynth.commandNo = CMD_FS;
    	freqSynth.startTrigger.triggerType = TRIG_NOW;
    	freqSynth.condition.rule = COND_NEVER;
    	freqSynth.frequency = 2402; //LL channel 37.
    	freqSynth.fractFreq = 0;
    	freqSynth.synthConf.bTxMode = 1;
    
    	SendCommand(&freqSynth);
    
    	uint8_t packet[0xFF];
    	uint32_t ieeeMac0 = HWREG(FCFG1_BASE + FCFG1_O_MAC_BLE_0);
    	uint32_t ieeeMac1 = HWREG(FCFG1_BASE + FCFG1_O_MAC_BLE_1);
    	packet[0] = ieeeMac0;
    	packet[1] = ieeeMac0 >> 8;
    	packet[2] = ieeeMac0 >> 16;
    	packet[3] = ieeeMac0 >> 24;
    	packet[4] = ieeeMac1;
    	packet[5] = ieeeMac1 >> 8;
    	for(int i=6; i<0xFF; i++)
    	{
    		packet[i] = i;
    	}
    
    	rfc_CMD_PROP_TX_t tx;
    	SetupCommandForImmediateExecution(&tx, CMD_PROP_TX);
    	tx.pktConf.bFsOff = 0;
    	tx.pktConf.bUseCrc = 1;
    	tx.pktConf.bVarLen = 1;
    	tx.pktLen = 2;
    	tx.syncWord = 0x2E89BED6;
    	tx.pPkt = packet;
    
    	while(true)
    	{
    		//tx.startTime += 2000000;//No idea where this 2000000 came from.  See rfPackTx.c in the CC1310DK_7XD\rfPacketTx example?
    		HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) = &tx;
    		while (HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDR) != 0x0) {}
    		cmdStat = HWREG(RFC_DBELL_BASE + RFC_DBELL_O_CMDSTA);
    		while (tx.status != 0x3400){} //0x3400 is PROP_DONE_OK
    		tx.status = 0;
    	}
    
    	return 0;
    }
    

  • Hi,

    I couldn't build your code as-is, but I suspect it uses a mix-and-match of the BLEstack and an updated TI-RTOS. Even if I go through the porting steps to the new TI-RTOS, the original issue seems related to the configuration steps of your code. Given my area of expertise is not on the device itself, I kindly ask you to check with the experts in the device forum and reference this thread, as they are better equipped to help you with your code.

    Regards,
    Rafael
  • It does not use the BLE stack or the TI-RTOS. The only additional #include folder search path is to the cc26xxware folder. In my case, it's at C:\ti\cc2640-ware-cc26xxware_2_23_00_16374. The linker needs the driverlib.lib file. On my machine, it was located at C:\ti\cc2640-ware-cc26xxware_2_23_00_16374\driverlib\bin\ccs\driverlib.lib.