Hi,
I created a board after the schematics and similar to the layout of the wireless sending board of the ez430 RF2500 and programmed it with a code. The problem is, that it sends one paket (that can be received from the ez430 RF2500), but when it goes the second time through the while(1), then it doesn't send the paket. The LED is on for the time until the TimerA sends an interrupt. Could it be that I have to initiate the CC2500 with SmartRF Studio or could it be a hardware issue? Because when I test the code with the ez430 RF2500 sending module it works fine! I really would appreciate it if you culd give me some help. Thank you.
Best regards
DP
Here's the code:
(The functions are from the MSP430/CC1100-2500 Interface Code Library v1.0)
#include "include.h"
#define TX_LENGTH 16 // CC2500 TX buffer length
#define PRESCALE 20 // I2C prescale
extern char paTable[]; // CC2500 pa table
extern char paTableLen; // CC2500 pa table length
char txBuffer[TX_LENGTH]; // CC2500 TX Buffer
void main (void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_8MHZ; // Set DCO
DCOCTL = CALDCO_8MHZ;
FCTL2 = FWKEY + FSSEL1 + FN4 + FN2; // MCLK/20 = 8MHZ/20 = 400kHz for Flash Timing Generator
P1DIR = 0xFF; // switch all ports off
P1OUT = 0x00;
P2SEL &= ~(0x40); // P2.6 as IO
TI_CC_SPISetup(); // initialize SPI port
TI_CC_PowerupResetCCxxxx(); // reset CCxxxx
writeRFSettings(); // write RF settings to CCxxxx config register
TI_CC_SPIWriteBurstReg(TI_CCxxx0_PATABLE, paTable, paTableLen); // Write CCxxxx PATABLE
TI_CC_SPIStrobe(TI_CCxxx0_SPWD); // sleep CCxxxx
// Configure ports -- LEDs, GDO0 to RX packet info from CCxxxx
TI_CC_LED_PxDIR = TI_CC_LED1+TI_CC_LED2; // LED ports
TI_CC_GDO0_PxIES |= TI_CC_GDO0_PIN; // interrupt on GDO0 falling edge (end of pkt)
TI_CC_GDO0_PxIFG &= ~TI_CC_GDO0_PIN; // clear GDO0 flag
TI_CC_GDO0_PxIE |= TI_CC_GDO0_PIN; // enable interrupt on end of packet
TI_CC_LED_PxOUT =0; // LEDs off
BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO
TACCTL0 = CCIE; // TimerA interrupt enabled
TACCR0 = 1500; // TimerA (12kHz) timeout: 1500 ~ 1 sec
TACTL = TASSEL_1 + MC_1 + ID_3; // ACLK, upmode (ID_3 => 1.5kHz = 12kHz / 8)
_EINT();
while(1)
{
txBuffer[0] = TX_LENGTH - 1; // packet length
txBuffer[1] = 1; // receiver address
txBuffer[2] = 1;
TI_CC_LED_PxOUT = 2; // switch green LED on
RFSendPacket(txBuffer, TX_LENGTH); // send CCxxx TX buffer over RF
TI_CC_LED_PxOUT = 0; // switch green LED off
TI_CC_SPIStrobe(TI_CCxxx0_SPWD); // CCxxxx sleep
__bis_SR_register(LPM3_bits+GIE); // MSP430 sleep
}
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
__bic_SR_register_on_exit(LPM3_bits);
}
#pragma vector=PORT2_VECTOR
__interrupt void port2_ISR (void)
{
__bic_SR_register_on_exit(LPM3_bits);
P2IFG &= ~TI_CC_GDO0_PIN; // Clear flag
}