Hello,
I'm using eZ430-RF2500 which is MSP430F2274 series and i wanna connect to external temperature sensor. This temperature sensor sends binary frames to our PC, and i want to adapt it to an ED. I am using the demo_ED that comes with the kit. Below is the code that I have written but it show me the follow erros and I don't know why is this happening. So, I am stucked here, I will appreciate if anybody helps me.
Thanks.
Jesus.
//************************ Librerias *******************************************
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\bsp.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\mrfi.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\nwk_types.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\nwk_api.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\bsp_leds.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\bsp_buttons.h"
#include "C:\Users\Luis\Desktop\eZ430-RF2500 Wireless Sensor Monitor\Embedded\IAR\Components\bsp\vlo_rand.h"
#include "msp430f2274.h"
//******************* Definiciones *********************************************
#define MISSES_IN_A_ROW 5 //define los intentos maximos a establecer conexion
#define Almacenamiento 9 //indica que el bufer utilizado llega al máximo
//************************Funciones de la Red*********************************
void MCU_init(void); // Inicialización del Microcontrolador
void linkTo(void); // Creación del Enlace
void createRandomAddress (); // Creación de las direcciones
void TXString(char* string, int length); // Transmisión del mensaje (mensaje + longitud)
//***************************Uso de la memoria flash****************************
__no_init volatile char Flash_Addr[4] @ 0x10F0; //Espacio de memoria Flash para almacenar 4 direcciones
addr_t Direcciones; //variable para almacenar direcciones
//**Variables relacionadas con el buffer de UART y los datos recibidos del RS232**
volatile static uint8_t Dato_Recibido_SizeUART=0,Dato_Recibido_SizeUART2=0; //vectores que recibiran los datos de la tarjeta
static uint8_t Dato_Recibido_UART[Almacenamiento], Dato_Recibido_UART2[Almacenamiento]; //dos arreglos de 8 posiciones
volatile int buffer_utilizado=1,buffer_que_envia=0; //indentificador del buffer que se esta usando y del que envia
//******************************************************************************
// PROGRAMA PRINCIPAL //
//******************************************************************************
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; //Detiene en WDT
//*****************Ciclo que asegura un inicio correcto***********************
volatile int j;
for(j=0; j<0xFFFF; j++)
{}
//*****************Calibración de los Dispositivos****************************
if(CALBC1_8MHZ==0xFF)
{
volatile int i;
P1DIR|=0x03; //en el puerto 1, los terminales 1 y 2 son salidas y el resto como entradas
BSP_TURN_ON_LED1(); // Prende en LED Rojo
BSP_TURN_OFF_LED2(); // Apaga el LED Verde
while(1)
{
for(i=0; i<0x5FFF; i++)
{}
BSP_TOGGLE_LED2();
BSP_TOGGLE_LED1();
}
}
//*******SimpliciTI cambiará la configuración de los puertos como sigue*******
P1DIR=0xFF; // Dirección del puerto 1
P1OUT=0x00; // Dirección de la salida del puerto 1
P2DIR=0x27;
P2OUT=0x00;
P3DIR=0xC0;
P3OUT=0x00;
P4DIR=0xFF;
P4OUT=0x00;
//**************** Inicialización del Hardware *******************************
BSP_init();
if(Flash_Addr[0]==0xFF && Flash_Addr[1]==0xFF && Flash_Addr[2]==0xFF && Flash_Addr[3]==0xFF)
{
createRandomAddress(); // Se llama la función para obtener las direcciones
}
//********************* Se almacenan las Direcciones**************************
Direcciones.addr[0]=Flash_Addr[0];
Direcciones.addr[1]=Flash_Addr[1];
Direcciones.addr[2]=Flash_Addr[2];
Direcciones.addr[3]=Flash_Addr[3];
SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &Direcciones); //Configuración del tiempo de ejecución
//*************************Inicializamos El Micro*******************************
BCSCTL1=CALBC1_8MHZ; // configura el parametro DCO
DCOCTL=CALDCO_8MHZ;
BCSCTL3|=LFXT1S_2; //LFXT1=VLO
TACCTL0=CCIE; //interrupcion por TACCR0 habilitada
TACCR0=12000; //~1 segundo
TACTL=TASSEL_1+MC_1; //ACLK, upmode
P3SEL|=0x30; //P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1=UCSSEL_2; // SMCLK
UCA0BR0=0x41; // 9600 de 8MHz
UCA0BR1=0x3;
UCA0MCTL=UCBRS_2;
UCA0CTL1&=~UCSWRST; // Incializa el estado de la máquina USCI
IE2|=UCA0RXIE; //habilita la interrupción por USCI_A0 RX
//***************Ciclo de espera de conexión del ED con el AP*****************
while(SMPL_NO_JOIN==SMPL_Init((uint8_t (*)(linkID_t))0))
{
BSP_TOGGLE_LED1();
BSP_TOGGLE_LED2();
__bis_SR_register(LPM3_bits+GIE);
}
//Llamamos a la funcion linkTo al realizar una conexion con el AP exitosamente
linkTo();
}
//******************************************************************************
// FIN DEL PROGRAMA PRINCIPAL //
//******************************************************************************
//**********************Creación de las Direcciones*****************************
void createRandomAddress()
{
unsigned int rand, rand2;
do
{
rand = TI_getRandomIntegerFromVLO(); //el primer byte no puede ser 0x00 ni 0xFF
}
while((rand & 0xFF00)==0xFF00||(rand & 0xFF00)==0x0000);
rand2 = TI_getRandomIntegerFromVLO();
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
}
//*************************Creación del Enlace**********************************
void linkTo()
{
linkID_t linkID1;
// Inicializa los LEDs
BSP_TURN_OFF_LED1();
BSP_TURN_OFF_LED2();
// Intenta establecer el enlace...
while (SMPL_SUCCESS != SMPL_Link(&linkID1))
{
__bis_SR_register(LPM3_bits + GIE); // LPM3 with interrupts enabled
BSP_TOGGLE_LED1();
BSP_TOGGLE_LED2();
}
for(int i=0; i<5; i++)
{
Dato_Recibido_UART2[i]=(uint8_t)(65+i);
Dato_Recibido_SizeUART2=5;
}
while(1)
{
if(buffer_que_envia==1)
{
if (SMPL_SUCCESS==SMPL_Send(linkID1, Dato_Recibido_UART, Dato_Recibido_SizeUART)) //se envian los datos vía Zigbee al buffer Dato_Recibido_UART
{
Dato_Recibido_SizeUART=0; //
buffer_que_envia = 0;
BSP_TOGGLE_LED2(); // Durante la transmisión de datos el LED verde papardea
BSP_TURN_OFF_LED1(); // Durante la transmisión de datos el LED rojo está apagado
}
}
if(buffer_que_envia==2) // if(Dato_Recibido_SizeUART2==Almacenamiento)
{
if (SMPL_SUCCESS == SMPL_Send(linkID1, Dato_Recibido_UART2, Dato_Recibido_SizeUART2))
{
Dato_Recibido_SizeUART2 = 0; // Si los datos han sido enviados con éxito inicializamos el buffer RX a 0
buffer_que_envia = 0;
BSP_TURN_OFF_LED1(); // Durante la transmisión de datos el LED rojo está apagado
BSP_TOGGLE_LED2(); // Durante la transmisión de datos el LED verde parpadea
}
}
}
}
//***************Transmitimos en Mensaje = Mensaje + longitud*******************
void TXString( char* string, int length )
{
int pointer;
for( pointer = 0; pointer < length; pointer++)
{
volatile int i;
UCA0TXBUF = string[pointer];
while (!(IFG2&UCA0TXIFG)); // Mientras el buffer esté listo (ocupado)
}
}
//******************************************************************************
// Timer A0 interrupt service routine
//******************************************************************************
#pragma vector = TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
__bic_SR_register_on_exit(LPM3_bits); // Clear LPM3 bit from 0(SR)
}
//****************Preparamos la trama que queremos enviar***********************
#pragma vector = USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
uint8_t rx = UCA0RXBUF;
if (buffer_utilizado==1)
{
if (Dato_Recibido_SizeUART < Almacenamiento)
{
BSP_TOGGLE_LED1(); // Mientras se reciben los datos parpadea el led rojo
Dato_Recibido_UART[Dato_Recibido_SizeUART++] = rx ; //
}
else
{
buffer_que_envia=1;
buffer_utilizado=2;
Dato_Recibido_SizeUART2=0;
}
if (buffer_utilizado==2)
{
if (Dato_Recibido_SizeUART2 < Almacenamiento)
{
BSP_TOGGLE_LED1(); // Mientras se reciben los datos parpadea el led rojo
Dato_Recibido_UART2[Dato_Recibido_SizeUART2++] = rx;
}
else
{
buffer_que_envia=2;
buffer_utilizado=1;
Dato_Recibido_SizeUART=0;
Dato_Recibido_UART[Dato_Recibido_SizeUART++] = rx;
}
}
}
}
The erros that it shows are:
Error[e46]: Undefined external "BSP_init" referred in main ( :\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error[e46]: Undefined external "SMPL_Ioctl" referred in main ( C:\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error[e46]: Undefined external "SMPL_Init" referred in main ( C:\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error[e46]: Undefined external "TI_getRandomIntegerFromVLO" referred in main ( C:\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error[e46]: Undefined external "SMPL_Link" referred in main ( C:\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error[e46]: Undefined external "SMPL_Send" referred in main ( C:\Users\Luis\Desktop\Tesis\pruebas\Debug\Obj\main.r43 )
Error while running Linker