Hello everyone
I’m trying to make a communication link between 2x MSP430FR5739 experimenter boards with the CC1120 radio modules using SimpliciTI v1.2.1 beta. I got the bsp files from the porting wiki and added them to my IAR project. The first goal is to toggle a led at the AP with a button on the end device.
Since the CC1120 radio module needed to be manually defined in mrfi_board_defs.h , My first question is: have I done this correctly or did I forgot something? (You can see the code I added below) I remember that it first threw me an error which I was able to fix by changing an interrupt routine somewhere.
Utilizing the simple API functions in my own program the SMPL_Init function returns “SMPL_NO_CHANNEL” which is supposed to mean that no Acces point was detected (while I do have one set up). Does this mean that my radio module is working correctly or does it also return this when the radio module is not configured correctly?
If I use the example application code “AP as data hub”, 2 leds on the acces point light up and 2 leds on the end device toggle indicating that no join has happened.
I’m a beginner with this so any help would be much appreciated :) I’ve also added my own simple application code below, any comments on this would also help.
Cheers!
mrfi_board_defs.h
/* ------------------------------------------------------------------------------------------------
* Defines
* ------------------------------------------------------------------------------------------------
*/
#if (defined MRFI_CC1120)
#define MRFI_BOARD_RSSI_OFFSET 100
#else
#error "ERROR: RSSI offset value not defined for this radio"
#endif
/* ------------------------------------------------------------------------------------------------
* Radio Selection
* ------------------------------------------------------------------------------------------------
*/
//CC1100 changed to cc1120
#if (!defined MRFI_CC1120) && \
(!defined MRFI_CC1101) && \
(!defined MRFI_CC1100E_470) && \
(!defined MRFI_CC1100E_950) && \
(!defined MRFI_CC2500) && \
(!defined MRFI_CC2420)
#error "ERROR: A compatible radio must be specified for the MSP-EXP430FR5739 board."
/*
* Since the MSP-EXP430FR5739 board can support several different radios, the installed
* radio must be specified with a #define. It is best to do this at the
* project level. However, if only one radio will ever be used, a #define
* could be placed here, above this error check.
*/
#endif
End device code
#include "bsp.h"
#include "mrfi.h"
#include "nwk_types.h"
#include "nwk_api.h"
#include "bsp_leds.h"
#include "bsp_buttons.h"
#include "nwk_pll.h"
void main(void)
{
static linkID_t LinkID = 0;
smplStatus_t statusTest = SMPL_SUCCESS;
BSP_Init();
statusTest = SMPL_Init(0);
SMPL_Link(&LinkID);
if (statusTest == SMPL_SUCCESS)
{
BSP_TOGGLE_LED1();
}
else if (statusTest == SMPL_NO_JOIN)
{
BSP_TOGGLE_LED2();
}
else if (statusTest == SMPL_NO_CHANNEL)
{
BSP_TOGGLE_LED3();
}
while(1)
{
if (BSP_BUTTON1() == 1)
{
SMPL_Send(LinkID,"Hot",4);
BSP_TOGGLE_LED4();
}
}
}
Acces point code
#include "bsp.h"
#include "mrfi.h"
#include "nwk_types.h"
#include "nwk_api.h"
#include "bsp_leds.h"
#include "bsp_buttons.h"
#include "nwk_pll.h"
#define SPIN_ABOUT_A_SECOND NWK_DELAY(1000)
void main(void)
{
static linkID_t LinkID = 0;
static linkID_t linkID;
uint8_t msg[MAX_APP_PAYLOAD], len;
BSP_Init();
SMPL_Init(0);
SMPL_LinkListen(&LinkID);
while(1)
{
BSP_TOGGLE_LED1();
// SPIN_ABOUT_A_SECOND;
while(SMPL_SUCCESS == SMPL_Receive(linkID, msg, &len))
{
if (msg == "Hot")
{
BSP_TOGGLE_LED2();
}
else
{
BSP_TOGGLE_LED3();
}
}
}
}