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.

CC430F5133 CODE TRANSCEIVER

Other Parts Discussed in Thread: CC430F5133

Hello, I am working with two CC430F5133. I have to send a packet of 8 bits acquired from a port of one of the two, to another. How can I do this? I downloaded the code examples in C. What changes should I make? And how can I call the routine to send a byte and how can I receve it?

From the hardware point of view may be sufficient to follow the pattern recommended in the datasheet of the microcontroller sender and the receiver?


Thank you very much

  • You shall start checking SPI and I2C source code examples - there is sample code for data communication between two msp430 ICs.

  • Thanks for the reply

    I'm sorry, I have not explained well. I need to transfer this data via transceiver 868 MHz

    Thanks

  • Sicne it is a CC chip, I guess he wants to send the data wireless. :)

    But of course that's only a guess.

  • Claudio Carmuco said:
    I'm sorry, I have not explained well. I need to transfer this data via transceiver 868 MHz

    Oh. Your initial question was clearly misleading asking to send data between ports of to chips.

    Claudio Carmuco said:
    I downloaded the code examples in C.

    Which examples? Did they work? Did you try to step through examples using debugger? If yes, then what exactly you did not understand?

    FYI evey CC-series radio evaluation kit package contain some example. Smaller kits have smaller and more easy to understand, examples.

    Claudio Carmuco said:
    What changes should I makeAnd how can I call the routine to send a byte and how can I receve it?

    What exactly in functionality you want to change?

  • Sorry, I'm at the beginning.
    I want to transfer a byte acquired via a port of the first cc430f5133 to a second cc430f5133, via wireless. How can I communicate that I want to transfer a byte to the micro 2? I have already made the antenna. The examples that I have read are referred to a transfer of fixed dimension data, variable data, data of smaller size and larger size of the FIFO, they are related to CC430F513x.
    I'm programming with IAR and after that I will transfer all datas to my micro.
    Can you help me? Thanks a lot

  • Claudio Carmuco said:
    I want to transfer a byte

    Claudio Carmuco said:
    referred to a transfer of fixed dimension data, variable data, data of smaller size and larger size

    If you know how to transfer data, then you know how to transfer byte.

    Claudio Carmuco said:
    Can you help me?

    Yes. With advice to read CC radio documentation, get better understanding how examples work. Start with "fixed dimension data transfer", make sure it works and you understand how it works. Then put your byte into first byte of fixed dimension data array and make sure your byte is transmitted over radio as part of fixed dimension data. When this part is done, it's easy to read I/O port bits to treat them as byte and transmit.

  • /******************************************************************************
    * 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 CC430x513x User's Guide, and/or 
    * SmartRF Studio.
    * 
    * G. Larmore
    * Texas Instruments Inc.
    * June 2012
    * Built with IAR v5.40.1 and CCS v5.2
    ******************************************************************************/
    
    #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        (0x51)          // 0 dBm output 
    
    extern RF_SETTINGS RfRegSettings;
    
    unsigned char packetReceived;
    unsigned char packetTransmit; 
    
    unsigned char RxBuffer[PACKET_LEN+2];
    unsigned char RxBufferLength = 0;
    const unsigned char TxBuffer[PACKET_LEN]= {0xAA, 0xBB, 0xCC, 0xDD, 0xEE};
    unsigned char buttonPressed = 0;
    unsigned int i = 0; 
    
    unsigned char transmitting = 0; 
    unsigned char receiving = 0; 
    
    void main( void )
    {  
      // Stop watchdog timer to prevent time out reset 
      WDTCTL = WDTPW + WDTHOLD; 
    
      // Increase PMMCOREV level to 2 for proper radio operation
      SetVCore(2);                            
      
      ResetRadioCore();     
      InitRadio();
      InitButtonLeds();
      
      ReceiveOn(); 
      receiving = 1; 
        
      while (1)
      { 
        __bis_SR_register( LPM3_bits + GIE );   
        __no_operation(); 
        
        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(&RfRegSettings);
      
      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(LPM3_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      
          }
          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(LPM3_bits);     
    }
    
    

     

    In IAR, I loaded the sample program "toggle led" but it gives error "Fatal error: failed to initialize device .... Session aborted," and after "Error debugee to load." I am attaching the file .c

    I select Fixed LT FIFO but it doesn't work
    I would to know what changes made ​​to the program to send  and receive the byte acquired in an internal register (for ex. R5).

    Can you help me?

    Thanks

  • Did it compile without errors? What kind of FET debugger and development board do you use? Did you manage to use it successfully before?

  • Thank you very much Ilmars

    -- Ilmars wrote the following post at Jul 15 2013 13:18 PM:

             Did it compile without errors? What kind of FET debugger and development board do you use?

    Yes, it compiles without errors e we are using a Launchpad.

    -- Did you manage to use it successfully before?

    No, this is the first time. I still have to load the program in the launchpad and then I have to pass it to my micro. I need to complete the code

  • Claudio Carmuco said:
    No, this is the first time.

    Then you have Launchpad FET problems. Forum is full of such kind of questions and solutions - use search.

    This is good place to start:

    http://processors.wiki.ti.com/index.php/MSP430_LaunchPad_(MSP-EXP430G2)

  • Thanks, but I need to build the code before. In IAR when I compile it doesn't give errors, but if I try to debug something seems not work properly. And I want to send a byte via wireless at 868 MHz.

  • Claudio Carmuco said:
    but if I try to debug something seems not work properly.

    Yes. Because you can't load compiled code into microcontroller successfully, because you have Launhpad FET debugger problem - it does not work. You either failed to install drivers properly or configure properly or something else.. Lot of such "it does not load into chip" threads are there in this forum. Use search.

**Attention** This is a public forum