how to transfer and receive a simple data (between two msp430 nodes) in IAR Embedded Workbench for msp430 using Experimental board MSP430F5438A.
please send me some example source code..
thanks in advanced.
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.
how to transfer and receive a simple data (between two msp430 nodes) in IAR Embedded Workbench for msp430 using Experimental board MSP430F5438A.
please send me some example source code..
thanks in advanced.
naresh babu merugu said:suppose i am taking input data is string "hello".....i want to transfer this string data in one MSP430 board to another(Experimental board is ti msp430f5438a) using cc2520
Open product page, http://www.ti.com/product/cc2520
Download source code examples, http://www.ti.com/litv/zip/swrc090b
Start with light switch application. After you are familiar with it, supposedly you will know how to send mode than on/off data.
what we need to transmit and receive the data between two msp430 nodes....in using IAR Embedded workbench IDE. i have experiment board that is msp430F5438A
1) how to do in programs
2) what exactly need
please help me.....
thanks.
naresh babu merugu said:1) how to do in programs
2) what exactly need
please help me.....
Open product page, http://www.ti.com/product/cc2520
Download source code examples, http://www.ti.com/litv/zip/swrc090b
Start with light switch application.
Krishna Rohit said:Can you help me with some sample codes to send a string between two nodes using SPI...
No. Point of engineering is to engineer, not to ask others do engineering work for you.
Instead I can give you an idea to begin with: all TI Sub-1GHz CC-series radios are more or less compatible from software point of view. So good idea would be to look for software of CC110L RF BoosterPack perhaps you need just slight changes
Thanks for the very quick reply. I have worked previously on Msp430f2274 in IAR with cc2500 , but I am totally new to this. The msp430g2553 with cc1101 is currently in our hands. So, just wanted to know if there are any sample codes for IAR. I also have the following code but I didn't find any output in the putty. I couldn't identify the problem. I would be greatful if you can help me out...
/******************************************************************************
Filename: CC1101_easy_link_tx.c
Description:
Notes:
******************************************************************************/
/*****************************************************************************
* INCLUDES
*/
#include "msp430.h"
#include "hal_board.h"
#include "cc1101_spi.h"
#include "hal_int_rf_msp_exp430g2.h"
#include "cc11xL_easy_link_msp_exp_430g2_reg_config.h"
#include "stdlib.h"
/******************************************************************************
* CONSTANTS
*/
/******************************************************************************
* DEFINES
*/
#define ISR_ACTION_REQUIRED 1
#define ISR_IDLE 0
#define PKTLEN 30
/******************************************************************************
* LOCAL VARIABLES
*/
static uint8 packetSemaphore;
static uint32 packetCounter;
/******************************************************************************
* STATIC FUNCTIONS
*/
static void registerConfig(void);
static void runTX(void);
static void createPacket(uint8 txBuffer[]);
static void radioRxTxISR(void);
/******************************************************************************
* @fn main
*
* @brief Runs the main routine
*
* @param none
*
* @return none
*/
void main(void)
{
//init MCU
halInitMCU();
//init LEDs
halLedInit();
//init button
halButtonInit();
halButtonInterruptEnable();
// init spi
exp430RfSpiInit();
// write radio registers
registerConfig();
// run either TX or RX dependent of build define
runTX();
}
/******************************************************************************
* @fn runTX
*
* @brief sends one packet on button push. Updates packet counter and
* display for each packet sent.
*
* @param none
*
* @return none
*/
static void runTX(void)
{
// Initialize packet buffer of size PKTLEN + 1
uint8 txBuffer[PKTLEN+1] = {0};
P2SEL &= ~0x40; // P2SEL bit 6 (GDO0) set to one as default. Set to zero (I/O)
// connect ISR function to GPIO0, interrupt on falling edge
trxIsrConnect(GPIO_0, FALLING_EDGE, &radioRxTxISR);
// enable interrupt from GPIO_0
trxEnableInt(GPIO_0);
// infinite loop
while(1)
{
// wait for button push
if(halButtonPushed())
{
//continiously sent packets until button is pressed
do
{
// update packet counter
packetCounter++;
// create a random packet with PKTLEN + 2 byte packet counter + n x random bytes
createPacket(txBuffer);
// write packet to tx fifo
cc1101SpiWriteTxFifo(txBuffer,sizeof(txBuffer));
// strobe TX to send packet
trxSpiCmdStrobe(CC1101_STX);
// wait for interrupt that packet has been sent.
// (Assumes the GPIO connected to the radioRxTxISR function is set
// to GPIOx_CFG = 0x06)
while(!packetSemaphore);
// clear semaphore flag
packetSemaphore = ISR_IDLE;
halLedToggle(LED1);
__delay_cycles(250000);
halLedToggle(LED1);
}while(!halButtonPushed());
}
}
}
/*******************************************************************************
* @fn radioRxTxISR
*
* @brief ISR for packet handling in RX. Sets packet semaphore, puts radio
* in idle state and clears isr flag.
*
* @param none
*
* @return none
*/
static void radioRxTxISR(void) {
// set packet semaphore
packetSemaphore = ISR_ACTION_REQUIRED;
// clear isr flag
trxClearIntFlag(GPIO_0);
}
/*******************************************************************************
* @fn registerConfig
*
* @brief Write register settings as given by SmartRF Studio
*
* @param none
*
* @return none
*/
static void registerConfig(void) {
uint8 writeByte;
#ifdef PA_TABLE
uint8 paTable[] = PA_TABLE;
#endif
// reset radio
trxSpiCmdStrobe(CC1101_SRES);
// write registers to radio
for(uint16 i = 0; i < (sizeof preferredSettings/sizeof(registerSetting_t)); i++) {
writeByte = preferredSettings[i].data;
cc1101SpiWriteReg( preferredSettings[i].addr, &writeByte, 1);
}
#ifdef PA_TABLE
// write PA_TABLE
cc1101SpiWriteReg(CC1101_PA_TABLE0,paTable, sizeof(paTable));
#endif
}
/******************************************************************************
* @fn createPacket
*
*
*/
static void createPacket(uint8 txBuffer[])
{
txBuffer[0] = PKTLEN; // Length byte
txBuffer[1] = (uint8) (packetCounter >> 8); // MSB of packetCounter
txBuffer[2] = (uint8) packetCounter; // LSB of packetCounter
// fill rest of buffer with random bytes
for(uint8 i =3; i< (PKTLEN+1); i++)
{
txBuffer[i] = (uint8)rand();
}
}
"Along with the necessary headers.The code sends a random packet . But when the application is downloaded into the device it doesn't show anything when a similar code for RX is run on the other device connected to PC with serial port connection".
Krishna Rohit said:I also have the following code but I didn't find any output in the putty. I couldn't identify the problem. I would be greatful if you can help me out...
Yes. sure I can help. - With advise to debug harder. Split your project into smaller chunks, debug them one by one. Add debug output, debug code using debugger to see how radio respond to commends. See which parts works as expected and which are not.
If you throw your code here and say "take look at it" what do you expect - that I will buy radio chip you use, compile your code, find problem in your code and tell what you shall fix? :)
Sorry I know that my questions are a bit annoying, but I'm in a real hurry to push the project towards completion.
Krishna Rohit said:, but I'm in a real hurry to push the project towards completion.
Read this: Urgent!
Krishna Rohit said:Can you help me by telling where should the address of the other device be set in the code pasted above.
Probably not. This doesn't look to be the only source file in the project. If I had to guess, it's somewhere in the function cc1101SpiWriteTxFifo() or perhaps defined in one of the .h header files.
Go look for it.
**Attention** This is a public forum