gwdeveloper

SimpiciTI Tutorial for CC2500

26 posts in this topic

This tutorial is meant to provide simple instruction to prepare a SimpliciTI wireless project using the TI Launchpad and CC2500 radio. Currently, CCSv5.1 will compile this program but have a few syntax errors. They can be ignored for now. CCSv4 will compile with no issues.

Please feel free to critique and ask questions. It helps to make us all better.

Part 1 of 2

Hardware Needed:
Launchpad with MSP430G2553
CC2500 Radio (several variants available; MDFLY CC2500 breakout or ez430-RF2500t)
(will insert an image of various hardware versions from TI to DIY)

Software Needed:
TI's CCS v5.1 http://processors.wi...hp/Download_CCS
SimpliciTI 1.1.1 for CCS http://www.ti.com/tool/simpliciti
LP_G2553.zip (launchpad BSP for simpliciTI)post-76-135135491572_thumb.png
2274_SimpliciTI_Toggle.zip (only needed for RF2500T used as slave; it will disable the cpu and set up peripherals to toggle leds) 2274_SimpliciTI_Toggle.zip

Step 1: Install Softwares.

- Install CCS v5 OR V6 for the MSP430 (if you don't already use CCS)
- Install SimpliciTI 1.1.1 (make note of the install directory; we'll use C:\Texas Instruments\SimpliciTI-CCS-1.1.1)
- unzip LP_G2553.zip bsp files to C:\Texas Instruments\SimpliciTI-CCS-1.1.1\Components\bsp\boards
- modified vlo_rand library for easy address assignment will be unzipped later
- for RF2500T, unzip 2274_SimpliciTI_Toggle.zip to your current CCS workspace
--- this project will need to be imported to CCS via Project -> Import Existing CCS Project

Step 2: Create CCS Project

-File -> New CCS Project
-Give project name. Select MSP430 Family and MSP430G2553 as variant. Connection should be left to default and Empty Project selected for template.
post-54-135135491551_thumb.jpg5_2folder_structure.JPG[/attachment]

Step 4: Create project file structure

-Now you will need to open the SimpliciTI\components folder.
--- for eg; C:\Texas Instruments\SimpliciTI-CCS-1.1.1\Components
(after the following actions, select "Link To" for the copy action)
-- drag 3 files from ..\bsp to the bsp project folder
-- drag 3 files from ..\mrfi to the mrfi project folder
-- drag all files from ..\Simpliciti\nwk to nwk project folder
-- drag all files from ..\Simpliciti\nwk_applications folder to nwk applications project folder
-We'll borrow the nwk .dat files from the EZ430RF project
--drag smpl_nwk_config.dat from \SimpliciTI-CCS-1.1.1\Projects\Examples\eZ430RF\Simple_Peer_to_Peer\CCS\Configuration to the configuration project folder.
--drag smpl_config.dat from \SimpliciTI-CCS-1.1.1\Projects\Examples\eZ430RF\Simple_Peer_to_Peer\CCS\Configuration\End_Device to the end device project folder.
[attachment=1]5_3linked_files.JPG[/attachment]

end of part 1. (limited due to 5 attachments per entry)

Share this post


Link to post
Share on other sites

Step 5: Add Includes and Predefines

 

-Right Click on Project -> Properties

-Under Build; MSP430 Compiler; Include Options

--Add SimpliciTI directories to include. There will be a total of 6 folders.

---\bsp

---\bsp\boards\LP_G2553

---\mrfi

---\nwk

---\nwk_applications

post-54-135135491542_thumb.jpg Add main files and create new configurations

 

-unzip the vlo_rand files and copy(not link) to your project's application folder

-cut and paste the main_rx.c and main_tx.c files into your project's application folder

main_tx.c

/* transmitter code */

#include "msp430g2553.h"
#include 

#include "bsp.h"                            // bsp header files
#include "bsp_leds.h"                       // included with simpliciti
#include "bsp_buttons.h"

#include "mrfi.h"                           // simpliciti headers
#include "nwk_types.h"
#include "nwk_api.h"

#include "vlo_rand.h"

/* global variables */

typedef struct sensors_struct
{
char cadc;
int iadc;
}my_sensors;

struct sensors_struct sensor;

unsigned int i;

volatile int ADCdata[10];				// dtc address

// for simpliciti tx/rx
linkID_t  linkIDTemp;
uint8_t   msg[8];

addr_t lAddr;
char *Flash_Addr;

/* end globals */

/* prototypes for init functions */
void Init_ADC10(void);
void Init_TIMER0A0(void);
void createRandomAddress(void);

/* end prototypes */

void main(void)
{

sensor.cadc = 'A';
sensor.iadc = 125;

 	BSP_Init();                               // init bsp first, then simpliciti

 	BCSCTL3 = LFXT1S_2; 					// aclk = vlo

 	// address check and creation
Flash_Addr = (char *)0x10F0;              // RF Address = 0x10F0
if( Flash_Addr[0] == 0xFF &&              // Check if device Address is missing
   	Flash_Addr[1] == 0xFF &&
   	Flash_Addr[2] == 0xFF &&
   	Flash_Addr[3] == 0xFF )
 	{
   	createRandomAddress();                  // Create Random device address at
}                                         // initial startup if missing
lAddr.addr[0] = Flash_Addr[0];
lAddr.addr[1] = Flash_Addr[1];
lAddr.addr[2] = Flash_Addr[2];
lAddr.addr[3] = Flash_Addr[3];
// load address
SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);

 	SMPL_Init(NULL);                          // null callback for TX

 	Init_ADC10();
 	Init_TIMER0A0();

 	do {                                       // wait for button
   if (BSP_BUTTON1())
   {
     break;
   }
 } while (1);

 while (SMPL_SUCCESS != SMPL_Link(&linkIDTemp))    // link to Rx
 {
   BSP_TOGGLE_LED1();                      // toggle red for not linked
 }

 	BSP_TURN_OFF_LED1();                      // red off
 	BSP_Delay(2000);                             // for 2 seconds
 	BSP_TURN_ON_LED1();

 	_EINT();                                  // Enable Global Interupts

 while (1)
 {
  BSP_TOGGLE_LED2();
   // adc with dtc in use
   ADC10CTL0 &= ~ENC;						// turn off adc10
   while (ADC10CTL1 & BUSY);               // wait if adc10 core is active
   ADC10SA = (unsigned int)ADCdata;    	// data buffer start
   ADC10CTL0 |= ENC + ADC10SC;             // sampling and conversion start

   LPM3;

   // insert sensor calculations here
 	// or
   // send raw adc data from P1.0
 	sensor.iadc = ADCdata[0];

// turn on radio and tx sensor struct
   SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, 0);
   SMPL_Send(linkIDTemp, (uint8_t *)&sensor, sizeof( my_sensors ));

 }
}

// setup adc10 to use dtc, 1 channels,
void Init_ADC10(void)
{
ADC10CTL0 &= ~ENC;													// turn off adc for settings
   ADC10CTL0 = ADC10ON + MSC + ADC10SHT_2 + SREF_0;					// turn on; multisample; 16 cycles; vcc/v--
   ADC10CTL1 = CONSEQ_2 + ADC10SSEL_0 + ADC10DIV_0 + SHS_0 + INCH_10;	// repeat single; smclk; /1; int temp sensor
   //ADC10AE0 = 0x01;													// enable adc channel; not needed for int temp
   ADC10DTC0 = ADC10CT;												// continuous transfer
   ADC10DTC1 = 10;														// 10 transfers/block
   ADC10SA = (unsigned int)ADCdata;									// start address for dtc conversions
   ADC10CTL0 |= ENC;
}

void createRandomAddress(void)
{
unsigned int rand, rand2;
char *Flash_Addr;
Flash_Addr = (char *)0x10F0;

do
{
   	rand = TI_getRandomIntegerFromADC();    // first byte can not be 0x00 of 0xFF
}
 	while( (rand & 0xFF00)==0xFF00 || (rand & 0xFF00)==0x0000 );
 	rand2 = TI_getRandomIntegerFromADC();

 	BCSCTL1 = CALBC1_1MHZ;                    // Set DCO to 1MHz
 	DCOCTL = CALDCO_1MHZ;
 	FCTL2 = FWKEY + FSSEL0 + FN1;             // MCLK/3 for Flash Timing Generator
 	FCTL3 = FWKEY + LOCKA;                    // Clear LOCK & LOCKA bits
 	FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation

Flash_Addr[0]=(rand>>8) & 0xFF;
 	Flash_Addr[1]=rand & 0xFF;
 	Flash_Addr[2]=(rand2>>8) & 0xFF;
 	Flash_Addr[3]=rand2 & 0xFF;

 	FCTL1 = FWKEY;                            // Clear WRT bit
 	FCTL3 = FWKEY + LOCKA + LOCK;             // Set LOCK & LOCKA bit
}


// enable Timer0a0 16bit up mode 
void Init_TIMER0A0(void)
{
 	TA0CCTL0 = CCIE;	// no capture, toggle
TA0CCR0 = 12000;    // about 1 sec with vlo
   TA0CTL = TASSEL_1 + ID_0 + MC_1;		// ACLK, /1, up mode
}

// Timer0A0 isr
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer0A0(void)
{
__no_operation();
// cycle alphabet to show part of struct transfer
if (sensor.cadc < 90)
{
	sensor.cadc = 'A';
} else
{
	sensor.cadc++;
}
 	LPM3_EXIT;                                // Exit LPM
}

main_rx.c

/* receiver code */

#include 
#include 
#include 

#include "vlo_rand.h"

#include "bsp.h"                          // bsp header files
#include "bsp_leds.h"                     // included with simpliciti
#include "bsp_buttons.h"

#include "mrfi.h"                         // simpliciti headers
#include "nwk_types.h"
#include "nwk_api.h"

/* global variables */

typedef struct sensors_struct
{
char cadc;
int iadc;
}my_sensors;

struct sensors_struct sensor;

/* bsp related variables */
linkID_t  linkIDTemp;
uint8_t smpl_buffer[MAX_APP_PAYLOAD];
uint8_t len;
uint8_t flag;

addr_t lAddr;
char *Flash_Addr;

static uint8_t sRxCallback(linkID_t);

void createRandomAddress(void);

/* end globals */

void main(void)
{	
 	BSP_Init();                               // init bsp first, then simpliciti

 	// address check and creation
Flash_Addr = (char *)0x10F0;              // RF Address = 0x10F0
if( Flash_Addr[0] == 0xFF &&              // Check if device Address is missing
   	Flash_Addr[1] == 0xFF &&
   	Flash_Addr[2] == 0xFF &&
   	Flash_Addr[3] == 0xFF )
 	{
   	createRandomAddress();                  // Create Random device address at
}                                         // initial startup if missing
lAddr.addr[0] = Flash_Addr[0];
lAddr.addr[1] = Flash_Addr[1];
lAddr.addr[2] = Flash_Addr[2];
lAddr.addr[3] = Flash_Addr[3];
// load address
SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);

 	SMPL_Init(sRxCallback);                         

SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_RXON, 0); // turn on radio, listen

while (SMPL_SUCCESS != SMPL_LinkListen(&linkIDTemp))    // link to Tx
{
	BSP_TOGGLE_LED1();                      // toggle red for not linked
}

 	BSP_TURN_OFF_LED1();                      // red off
 	NWK_DELAY(2000);                             // for 2 seconds
 	BSP_TURN_ON_LED1();

 	_EINT();                                  // Enable Global Interupts

while (1)
{		

}
}

static uint8_t sRxCallback(linkID_t linkIDTemp)
{
SMPL_Receive(linkIDTemp, (uint8_t*)&smpl_buffer, &len);

if(len == sizeof(my_sensors))
{
 		memcpy(&sensor, smpl_buffer, len);
} else {
 	__no_operation();
 	BSP_TOGGLE_LED1();
}

// replace with_  return message;
return 0;
}

void createRandomAddress(void)
{
 unsigned int rand, rand2;
 char *Flash_Addr;
 Flash_Addr = (char *)0x10F0;

 do
 {
   rand = TI_getRandomIntegerFromADC();    // first byte can not be 0x00 of 0xFF
 }
 while( (rand & 0xFF00)==0xFF00 || (rand & 0xFF00)==0x0000 );
 rand2 = TI_getRandomIntegerFromADC();

 BCSCTL1 = CALBC1_1MHZ;                    // Set DCO to 1MHz
 DCOCTL = CALDCO_1MHZ;
 FCTL2 = FWKEY + FSSEL0 + FN1;             // MCLK/3 for Flash Timing Generator
 FCTL3 = FWKEY + LOCKA;                    // Clear LOCK & LOCKA bits
 FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation

 Flash_Addr[0]=(rand>>8) & 0xFF;
 Flash_Addr[1]=rand & 0xFF;
 Flash_Addr[2]=(rand2>>8) & 0xFF;
 Flash_Addr[3]=rand2 & 0xFF;

 FCTL1 = FWKEY;                            // Clear WRT bit
 FCTL3 = FWKEY + LOCKA + LOCK;             // Set LOCK & LOCKA bit
}

-Right click on your project -> properties to create new configurations

-from main panel, select "Manage Configurations"

-- create RX and TX configurations, copying settings from existing Debug configuration

 

This section will need to be repeated for each build configuration.

-Under Build; MSP430 Compiler; Advanced Options; Command Files

--add links to the EZ430RF project's nwk .dat files

[attachment=0]5_commandfiles.JPG[/attachment]

-Under Build; MSP430 Compiler; Advanced Options; Predefined Symbols

--Add new Pre-define Name "MRFI_CC2500"

 

-press ok to return.

--right click project -> Build Configurations -> Set Active -> RX

--right click main_tx.c -> Resource Configurations -> Exclude from Build

-Repeat the process, making TX the active Build Configuration and excluding main_rx.c

 

If you followed these instructions, you're currently ready to build the TX side of the application. Click the hammer and build the application. If you get any errors, follow back through the steps to make sure you have all of the settings and includes properly configured. If all is well, program your LP and press play. Of course not much will happen until you program the RX application and debug it as well. Very simply, it creates a connection and transmits analog data read from the internal temp sensor.

 

These example applications are creating the most simplified connection with no dropped connection checks. Use the SimpliciTI API to extend the applications with Link_To and Listen_To. Changing the configuration .dat files will also also for multiple end devices and one access point.

 

I hope this tutorial helped a few people out with running the SimpliciTI RF wireless stack. The instructions can be followed to run SimpliciTI on the Launchpad with G2553, ez430-RF2500t and MSP-EXP430F5529 development board(or the sweet F5529 board found on 43oh.com). BTW, this can also run on an EvalBot with minor changes.

yoyogin, RobG and legailutin like this

Share this post


Link to post
Share on other sites

Sorry to bother GW,

 

I tried to load up that g2553 code you posted, and i was bounced for code size violation. Does this mean I need to purchase ISR upgrade? what are you using. I prefer CCS, but i cant seem to find the project folder posted anywhere....

 

thanks. KB

Share this post


Link to post
Share on other sites

Hello KB.

 

There shouldn't be any code size violations with the demo of CCS. The demo TX program compiles to about 8.5K which is well under the 16K limit of CCS.

 

If you're using IAR Kickstart, you'll run out of room at 4K. Also, the bsp for the G2553 I uploaded will only work in the CCS version of SimpliciTI. IAR's version has different declarations for the interrupts and variables.

kenemon likes this

Share this post


Link to post
Share on other sites

Just wanted to add a SimpliciTI BSP for the MSP-EXP430FR5739 board as well. Finally got the clock and SPI configured properly.

[attachment=0]EXPFR5739.zip[/attachment]

bluehash likes this

Share this post


Link to post
Share on other sites

Thanks GW,

 

sorry to keep pecking at you. I managed to get CCS working, but as I am trying to work with SimpliciTI and the LSR WiFi modules, I am a little stuck. Looks like I need a 4wire JTAG programmer..... Too bad the LP doesnt break out a few more pins on the F chip. Makes me think it was intentional to ensure the longevity of their $100+ programmer..

 

KB

Share this post


Link to post
Share on other sites

I've looked at the LSR wifi modules but never had a chance to test with one. LSR does have a SimpliciTI porting guide in their download section though. You may want to look at that to see if it requires any other changes.

kenemon likes this

Share this post


Link to post
Share on other sites

@GW: I have seen that (unreleased) porting guide there, I am trying to learn from you, because they only provide an IAR package. Did you get any LSR modules when they were passing by?

Share this post


Link to post
Share on other sites

HI All,

 

some confusion here regarding the wireless chips. In general, I understand using the TI chips require programming with the cc-debugger. However, some of the evm's use other evm's to program them. Similar to the LP (has onboard debugger), that makes sense. My question is on the soc chips, do you need to program both the mcu AND the radio chip? Or, is the firmware something that isnt accessable at that point? Do the CC2500's come with preinstalled firmware, or did you need to program them for this project?

 

Thanks.

Share this post


Link to post
Share on other sites

Hi I would like to know how this can be implemented on the CC110L booster pack. I also can't seem to see the images attached.

Share this post


Link to post
Share on other sites

Yea I got the images to show up, now I am just trying to figure out how to use this tutorial with CC110L. If anyone knows how I would appreciate it if you could let me know how.

Share this post


Link to post
Share on other sites

Couple of issues:
1) I cannot see any of the pictures. (but I was able to configure the project and compile it OK).
2) Is there a schematic for wiring the MSP430 Launchpad with G2553 to the CC2500 Module that you get from 43oh store?

Adding: I assume the configuration is as follows from mrfi_board_defs:
Launchpad pins -> cc2500 module pin
P1.4 -> P8 (Chip Select)
P1.5 -> P3 (SPI clock)
P1.6 -> P2 (SPI transfer)
P1.7 <- P4 (SPI transfer)

P1.6 -> P4 (SPI transfer)
P1.7 <- P2 (SPI transfer)
VCC -> P1 (Vcc)
GND -> P6 (Gnd)

                                                                                                                         

 

Share this post


Link to post
Share on other sites

Hi the link for 2274_SimpliciTI_Toggle.zip seems to to just bring me to the dropbox 404 page. Could you provide a mirror? Thanks in advance

Share this post


Link to post
Share on other sites

I'm still not seeing the pictures. I had a long break from working on this project a long time and did a redo of the instructions. Since I couldn't see the pictures I may be missing something. I had to add \bsp\drivers to the project to get it to compile. Otherwise it gave "bsp_leds.h could not be read" error.

Share this post


Link to post
Share on other sites

Hi

 

I get a compile error in   bsp.c

 

#161 declaration is incompatible with previous "BSP_InitLeds" (declared at line 62 of "C:/Texas Instruments/SimpliciTI-CCS-1.1.1/Components/bsp/boards/LP_G2553/bsp_drivers.c")     /SimpliTi/bsp    line 119, external location: C:\Texas Instruments\SimpliciTI-CCS-1.1.1\Components\bsp\drivers\bsp_leds.h

 

Any ideas what went wrong ?

 

Cheers

Michael
 

Share this post


Link to post
Share on other sites

Finally I got the code and modules up and running.

 

Issues:

Led does not work.

I found no way to reconfigure and use the cc2500 booster board

Just changing the pin mapping was not enough

 

Without debugger I would have had no chance what so ever,...

Ti supplies a great environment

 

Once I figured the issues out, I will blog about the solutions.

 

Cheers

Rubi

http://rubines.blogspot.co.at/

Share this post


Link to post
Share on other sites

Hello,
I'm new to MSP430, but I want to try this out really bad. I got this code almost working. Now LED on RX side toogles once about 4-5 seconds, while LED on TX side just stays on. Somehow they do not link to each other. Could you help me figure this out? :!!!:

Share this post


Link to post
Share on other sites

Ok, I have followed these instructions 4 or 5 times now, and I cannot get a project to build. I think I am close though. None of the pictures in your guide are showing up for me, so I may be missing something. Once I follow all of your instructions, I get 13 errors, most of which resemble the following two types of errors. Any idea what I am doing wrong?

 

ERRORS:

#10056 symbol "BSP_Delay" redefined: first defined in "./components/bsp/boards/EZ430RF/bsp_board.obj"; redefined in "./components/bsp/bsp.obj" RF2500 C/C++ Problem
 
unresolved symbol TA0CTL, first referenced in ./application/vlo_rand.obj RF2500 C/C++ Problem
 
Screenshot:
Capture_zps60c4ea37.png
 
*Edit: I am using CCS V5.4

Share this post


Link to post
Share on other sites

Another 4 hours wasted trying to figure out if my pins are even correct. Blarg. I think I'm ready to give up on these modules.

Last Hail Mary request, if anyone is still working on these:

 

1) Does the example given by the OP include activating the SPI bus? If so, were my pin assumptions in the earlier post correct?

Launchpad pins -> cc2500 module pin
P1.4 -> P8 (Chip Select)
P1.5 -> P3 (SPI clock)
P1.6 -> P2 (SPI transfer)
P1.7 <- P4 (SPI transfer)
VCC -> P1 (Vcc)
GND -> P6 (Gnd)

 

2) If not so, do I need to active SPI bus with my own code, or use the SimpliciTI provided mrfi_spi.c to do so?

 

I feel like there is something simple that I'm missing but I don't know what it is.

Share this post


Link to post
Share on other sites

@@MarkusR

 

1a) Yes, SPI activation is done by the Simpliciti BSP.

 

1b) You have no connection for GDO0 or GDO2.

 

Check:

./LP_2553/bsp_external/mrfi_board_defs.h

  There you will find the SPI init macro as well as the pin definitions.

MarkusR likes this

Share this post


Link to post
Share on other sites

So if I want to connect the G2553-CC2500 to an ez430-RF2500T that is running the Wireless Sensor Monitor (WSM) demo, should it "connect"? Or at the very least join the AP's network?

 

OK. It works.

 

My only "issue" after all the fun is that the LP_G2553 board def file uses pins 2.6 & 2.7 by default for GDO. These are the XIN & XOUT pins, which happen to not be connected to the IC on the current LP boards (were they before?). I changed the def file to use 2.4 & 2.5, and it fixed it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now