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.

CCS4 Watch List Update Bug

Other Parts Discussed in Thread: CC430F6137, CC1101

Dear Community,

Has anyone else experienced having their Watch List fail to update consistently? I know that it's failing because I've used an LED to check some of my code. Is there a setting that I'm not using correctly? I single step through an i++ statement in a debug session and the Watch List doesn't change for that variable.

Thank you for your help! 

  • Hello,

    A reproducible test case would be helpful (project). This issue is with using the CC430F6137?

    Thanks

    ki

  •  

    Dear Ki,

    Below is an alteration of the one of the RF examples that I have been using. (You need to get all the other files to include from the RF_Toggle_LED_Demo available at http://focus.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=slaa465&docCategoryId=1&familyId=1663 .) I added  the variable uc500msTick to the Watch List and put a breakpoint in the Timer A interrupt right after the ++ operation. It seems to always display the value (in decimal) as 63 rather than incrementing from 0. Would the 63 be because I didn't initialize the global variable in main()? The issue is for the CC430F6137 as you have mentioned.

    Thank you!

    P.S. Is there a better way to include this C file rather than copy-pasting the whole thing in here?

     

    /******************************************************************************

    * CC430 RF Code Example - TX and RX (fixed packet length =< FIFO size)

    *

    * Simple RF Link to Toggle Receiver's LED by pressing Transmitter's Button    

    * Warning: This RF code example is setup to operate at either 868 or 915 MHz, 

    * which might be out of allowable range of operation in certain countries.

    * The frequency of operation is selectable as an active build configuration

    * in the project menu. 

    * Please refer to the appropriate legal sources before performing tests with 

    * this code example. 

    * This code example can be loaded to 2 CC430 devices. Each device will transmit 

    * a small packet, less than the FIFO size, upon a button pressed. Each device will also toggle its LED 

    * upon receiving the packet. 

    * The RF packet engine settings specify fixed-length-mode with CRC check 

    * enabled. The RX packet also appends 2 status bytes regarding CRC check, RSSI 

    * and LQI info. For specific register settings please refer to the comments for 

    * each register in RfRegSettings.c, the CC430x613x User's Guide, and/or 

    * SmartRF Studio.

    * M. Morales/D. Dang

    * Texas Instruments Inc.

    * June 2010

    * Built with IAR v4.21 and CCS v4.1

    ******************************************************************************/

     

    #include "RF_Toggle_LED_Demo.h"

     

    #define  PACKET_LEN         (0x05) // PACKET_LEN <= 61

    #define  RSSI_IDX           (PACKET_LEN)    // Index of appended RSSI 

    #define  CRC_LQI_IDX        (PACKET_LEN+1)  // Index of appended LQI, checksum

    #define  CRC_OK             (BIT7)          // CRC_OK bit 

    #define  PATABLE_VAL        (0x8D) ///should be 0x8D for 868//(0x51)          // 0 dBm output 

    #define  RX_TIMEOUT         (60)   // (# of seconds to wait x 2) = (# of 500ms ticks)

     

    extern RF_SETTINGS rfSettings;

     

    unsigned char packetReceived;

    unsigned char packetTransmit; 

     

    unsigned char RxBuffer[PACKET_LEN+2];

    unsigned char RxBufferLength = 0;

    const unsigned char TxBuffer[PACKET_LEN]={69,15,25,36,72};

    unsigned char buttonPressed = 0;

    unsigned int i = 0; 

     

    unsigned char transmitting = 0; 

    unsigned char receiving = 0; 

    unsigned char ucReceivedMessage = 0;

    unsigned char uc500msTick = 0;

     

    void main( void )

    {  

    unsigned char x=0;

     

      // Stop watchdog timer to prevent time out reset 

      WDTCTL = WDTPW + WDTHOLD; 

     

    // Keep default XT1CLK (currently not on unless selected as source) as ACLK source

    // Set sub-master clock source to be XT1CLK (32.768K crystal)

    // CANNOT: Set master CPU clock to be same clock as RF module (26MHz RF crystal)

    // since it is higher than the max freq of the chip (20MHz)

    // THUS: Set MCLK as the 32.768K crystal

    UCSCTL4 = SELA__XT1CLK + SELS__XT1CLK + SELM__XT1CLK;  

     

    // Turn off subsystem master clock since we are not using it

    UCSCTL6 |= SMCLKOFF;

     

    // Keep default 1/1 divisor for ACLK on external pin

    // Keep default 1/1 divisor for ACLK

    // Keep default 1/1 divisor for SMCLK

    // Keep default 1/1 divisor for MCLK

    //UCSCTL5 = DIVPA__1 + DIVA__1 + DIVS__1 + DIVM__1;

     

      // Increase PMMCOREV level to 2 for proper radio operation

      SetVCore(2);                            

     

      ResetRadioCore();     

      InitRadio();

      InitButtonLeds();

     

      ReceiveOn(); 

      receiving = 1; 

     

      // (Keep no capture on)

      // (Keep default capture/compare input)

      // (Keep defalt async capture source)

      // (Stay in default compare mode)

      // (Keep default output mode)

      // Enable CCR0 interrupt

      // (Keep default output)

      // (Clear capture overflow indicator)

      // (Clear interrupt flag)

      TA1CCTL0 = CCIE;

     

      // Set TA1CCR0 value to have a 500ms tick

      // We want 16,384 counts and the number of timer counts 

      // in a period is (TA1CCR0 + 1), thus we set it to 15,3843

      TA1CCR0=16383;

     

      // (Using TA1 since it has less capture/compare registers)

      // Select Timer A1 clock as SMCLK (starts timer)

      // Keep TA1 divisor as 1

      // Set TA1 to be in count up mode (count to value in TA1CCR0)

      // Clear TA1

      // (Disable TAIFG interrupts)

      // (Clear the interrupt flag at onset) 

      TA1CTL = TASSEL__ACLK + ID__1 + MC__UP + TACLR;   

     

      while(1)

      { 

        __bis_SR_register(LPM4_bits + GIE);

        __no_operation(); 

     

        // Check if we have successfully received a message

        if(ucReceivedMessage)

        {

        // Turn off red timeout LED

        P3OUT &= ~BIT6;

       

        // We can reset the timer and use it

        // for timing the LED blinks to the user

     

        // Pulse the green LED a many times as the tens digit  

        // of the number received through RF comm; toggle every 500ms

        for(x=0;x<2*(RxBuffer[0]/10);++x)  

            {           

            P1OUT ^= BIT0;                  // Toggle GREEN

            TA1CTL|=TACLR; // Clear TA1

            TA1CTL&=~TAIFG; // Reset TA1 Flag

            while(!(TA1CTL&TAIFG)); // Wait 500ms

              TA1CTL&=~TAIFG; // Reset TA1 Flag

            }

       

        // Pulse the red LED a many times as the ones digits 

        // of the number received through RF comm; toggle every 500ms

        for(x=0;x<2*(RxBuffer[0]%10);++x)

            {           

            P3OUT ^= BIT6;                  // Toggle RED

            TA1CTL|=TACLR; // Clear TA1

            TA1CTL&=~TAIFG; // Reset TA1 Flag

            while(!(TA1CTL&TAIFG)); // Wait 500ms

              TA1CTL&=~TAIFG; // Reset TA1 Flag

            }

       

        // Reset number of ticks we have been waiting

        uc500msTick=0;

       

        // Reset that we need to receive a message 

        // (this means that any message received while we were blinking is ignored...need++ to not ignore)

        ucReceivedMessage=0;

        }

     

        // Poll to see if we've have gotten a reply w/in a min and turn on

        // the red LED if we have timed out.

        if(uc500msTick>=RX_TIMEOUT)

        {

        P3OUT |= BIT6;

        uc500msTick=0;

        }

     

        // Transmitting/Receiving operations

        if (buttonPressed)                      // Process a button press->transmit 

        {

          P3OUT |= BIT6;                        // Pulse LED during Transmit                          

          buttonPressed = 0; 

          P1IFG = 0; 

     

          ReceiveOff();

          receiving = 0; 

          Transmit( (unsigned char*)TxBuffer, sizeof TxBuffer);         

          transmitting = 1;

     

          P1IE |= BIT7;                         // Re-enable button press  

        }

        else if(!transmitting)

        {

          ReceiveOn();      

          receiving = 1; 

        }

      }

    }

     

    void InitButtonLeds(void)

    {

      // Set up the button as interruptible 

      P1DIR &= ~BIT7;

      P1REN |= BIT7;

      P1IES &= BIT7;

      P1IFG = 0;

      P1OUT |= BIT7;

      P1IE  |= BIT7; 

     

      // Initialize Port J

      PJOUT = 0x00;

      PJDIR = 0xFF; 

     

      // Set up LEDs 

      P1OUT &= ~BIT0;

      P1DIR |= BIT0;

      P3OUT &= ~BIT6;

      P3DIR |= BIT6;

    }

     

    void InitRadio(void)

    {

      // Set the High-Power Mode Request Enable bit so LPM3 can be entered

      // with active radio enabled 

      PMMCTL0_H = 0xA5;

      PMMCTL0_L |= PMMHPMRE_L; 

      PMMCTL0_H = 0x00; 

     

      WriteRfSettings(&rfSettings);

     

      WriteSinglePATable(PATABLE_VAL);

    }

     

    #pragma vector=PORT1_VECTOR

    __interrupt void PORT1_ISR(void)

    {

      switch(__even_in_range(P1IV, 16))

      {

        case  0: break;

        case  2: break;                         // P1.0 IFG

        case  4: break;                         // P1.1 IFG

        case  6: break;                         // P1.2 IFG

        case  8: break;                         // P1.3 IFG

        case 10: break;                         // P1.4 IFG

        case 12: break;                         // P1.5 IFG

        case 14: break;                         // P1.6 IFG

        case 16:                                // P1.7 IFG

          P1IE = 0;                             // Debounce by disabling buttons

          buttonPressed = 1;

          __bic_SR_register_on_exit(LPM4_bits); // Exit active    

          break;

      }

    }

     

    void Transmit(unsigned char *buffer, unsigned char length)

    {

      RF1AIES |= BIT9;                          

      RF1AIFG &= ~BIT9;                         // Clear pending interrupts

      RF1AIE |= BIT9;                           // Enable TX end-of-packet interrupt

     

      WriteBurstReg(RF_TXFIFOWR, buffer, length);     

     

      Strobe( RF_STX );                         // Strobe STX   

    }

     

    void ReceiveOn(void)

    {  

      RF1AIES |= BIT9;                          // Falling edge of RFIFG9

      RF1AIFG &= ~BIT9;                         // Clear a pending interrupt

      RF1AIE  |= BIT9;                          // Enable the interrupt 

     

      // Radio is in IDLE following a TX, so strobe SRX to enter Receive Mode

      Strobe( RF_SRX );                      

    }

     

    void ReceiveOff(void)

    {

      RF1AIE &= ~BIT9;                          // Disable RX interrupts

      RF1AIFG &= ~BIT9;                         // Clear pending IFG

     

      // It is possible that ReceiveOff is called while radio is receiving a packet.

      // Therefore, it is necessary to flush the RX FIFO after issuing IDLE strobe 

      // such that the RXFIFO is empty prior to receiving a packet.

      Strobe( RF_SIDLE );

      Strobe( RF_SFRX  );                       

    }

     

    #pragma vector=CC1101_VECTOR

    __interrupt void CC1101_ISR(void)

    {

      switch(__even_in_range(RF1AIV,32))        // Prioritizing Radio Core Interrupt 

      {

        case  0: break;                         // No RF core interrupt pending                                            

        case  2: break;                         // RFIFG0 

        case  4: break;                         // RFIFG1

        case  6: break;                         // RFIFG2

        case  8: break;                         // RFIFG3

        case 10: break;                         // RFIFG4

        case 12: break;                         // RFIFG5

        case 14: break;                         // RFIFG6          

        case 16: break;                         // RFIFG7

        case 18: break;                         // RFIFG8

        case 20:                                // RFIFG9

          if(receiving)    // RX end of packet

          {

            // Read the length byte from the FIFO       

            RxBufferLength = ReadSingleReg( RXBYTES );               

            ReadBurstReg(RF_RXFIFORD, RxBuffer, RxBufferLength); 

     

            // Stop here to see contents of RxBuffer

            __no_operation();   

     

            // Check the CRC results

            if(RxBuffer[CRC_LQI_IDX] & CRC_OK)

           {//P1OUT ^= BIT0;                  // Toggle LED1

           ucReceivedMessage=1;}

          }

          else if(transmitting)    // TX end of packet

          {

            RF1AIE &= ~BIT9;                    // Disable TX end-of-packet interrupt

            P3OUT &= ~BIT6;                     // Turn off LED after Transmit               

            transmitting = 0; 

          }

          else while(1);    // trap 

          break;

        case 22: break;                         // RFIFG10

        case 24: break;                         // RFIFG11

        case 26: break;                         // RFIFG12

        case 28: break;                         // RFIFG13

        case 30: break;                         // RFIFG14

        case 32: break;                         // RFIFG15

      }  

      __bic_SR_register_on_exit(LPM4_bits);     

    }

     

    // Timer A0 interrupt service routine

    #pragma vector=TIMER1_A0_VECTOR

    __interrupt void TIMER1_A0_ISR(void)

    {

      ++uc500msTick;

      __bic_SR_register_on_exit(LPM4_bits);     

    }