Modifying the Wireless Sensor Monitor Embedded code to work with Low-Power PEH
The Wireless sensor Monitor program only runs on Windows-XP. Sometimes it can work in latest windows OS but after disconnect, it might not reconnect and you can have inconvenience in troubleshooting.
Start IAR Embedded workbench 5.60.7
Extract Slac139g.zip into a folder and open it as workspace in IAR.
Open the Go to menu; Project --> Edit Configuration. And choose "CC2500 Sensor Demo-End Device"
Go to menu; Tools --> option --> Editor. Click the checkbox "Show line numbers"
In workspace, open the following file: Sensor-Cemo_AP_as_Data_Hub-CC2500 Sensor Demo-End Device --> Applications --> End Device --> main_ED.c
In main code, set TACCR0 to 60000, the time delay is now set at 5 seconds, the previous value will set it at 1 sec.
Comment the following code as below in while (SMPL_SUCCESS != SMPL_Init(0)) to save power in LED turn ON and OFF
//BSP_TOGGLE_LED1(); //Hamid: comment to save power
//BSP_TOGGLE_LED2(); //Hamid: comment to save power
/* LEDs on solid to indicate successful join. */
//BSP_TURN_ON_LED1(); //Hamid: comment to save power
//BSP_TURN_ON_LED2(); //Hamid: comment to save power
Comment the following code as below in static void linkTo() to save power in LED turn ON and OFF
//BSP_TOGGLE_LED1(); //Hamid: comment to save power
//BSP_TOGGLE_LED2(); //Hamid: comment to save power
/* Turn off LEDs. */
//BSP_TURN_OFF_LED1(); //Hamid: comment to save power
//BSP_TURN_OFF_LED2(); //Hamid: comment to save power
Following changes are to reduce the Power Consumption of the wireless Transceiver CC2500. It will also result in the reduced data communication distance between End_device and AP. Define new Power Level of the Tx in mrfi_fif2.c file. The values in the table are from low to high. The default settings set 3 values: -20 dBm, -10 dBm, and 0 dBm. The default at startup is the highest value. I swap the values, so the default is the lowest value always.
In workspace under Components --> mrfi--> Output folder --> mrfi_f1f2.c change the following
#if defined( MRFI_CC2500 )
static const uint8_t mrfiRFPowerTable[] =
{
0xFE, // I swept the lower and highest values in the table, so the default Power is always Lowest
0x97,
0x46
};
In the main_ED.c--> main code after BSP_Init() add following lines
/* Set desired output power */
sCurrentPwrLevel = MAXIMUM_OUTPUT_POWER;
/* IOCTL_ACT_RADIO_SETPWR is defined in nwk_ioctl.c */