This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

EZ



 

Hi,guys. I'm working on a project using EZ430-RF2500 development kit. What I'm trying to do is to read from a JTAG port of a board my company designed, and send the information to the AcessPoint without changing anything. The original serial transmission uses UART at baud rate 9600. Sounds very simple. I made some changes to the demo code of development kit.  But when I check my console window, it showed some number 37.7 something. I haven't change the accesspoint code yet. But it doesn't change. Can someone take a brief look at my part of code, and tell me if I did any thing wrong? Or maybe give me some idea.

Thank you.

Node:0001,Temp: 37.7F,Battery:0.0V,Strength:056%,RE:no
Node:0001,Temp: 37.7F,Battery:0.0V,Strength:056%,RE:no
Node:HUB0,Temp: 80.7F,Battery:3.5V,Strength:000%,RE:no
Node:0001,Temp: 37.7F,Battery:0.0V,Strength:055%,RE:no
Node:HUB0,Temp: 80.7F,Battery:3.5V,Strength:000%,RE:no
Node:0001,Temp: 37.7F,Battery:0.0V,Strength:055%,RE:no
Node:HUB0,Temp: 80.7F,Battery:3.5V,Strength:000%,RE:no

 

uint8_t  received;
void linkTo()
{
  linkID_t linkID1;
  uint8_t  msg[8];

  // keep trying to link...
  while (SMPL_SUCCESS != SMPL_Link(&linkID1))
  {
    __bis_SR_register(LPM3_bits + GIE);     // LPM3 with interrupts enabled
    BSP_TOGGLE_LED1();
    BSP_TOGGLE_LED2();
  }
  
  // Turn off all LEDs
  if (BSP_LED1_IS_ON())
  {
    BSP_TOGGLE_LED1();
  }
  if (BSP_LED2_IS_ON())
  {
    BSP_TOGGLE_LED2();
  }

  while (1)
  {
    P3SEL |=0x30;
    UCA0CTL1=UCSSEL_2;
    UCA0BR0=0x41;
    UCA0BR1=0x3;
    UCA0MCTL=UCBRS_2;
    UCA0CTL1 &=~UCSWRST;
   
   
    volatile long temp;
    int degC, volt;
    int results[2];
    SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, "" );
    IE2|=UCA0RXIE;
    __bis_SR_register(LPM3_bits+GIE);       // LPM3 with interrupts enabled
    SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, "" );
   
    BSP_TOGGLE_LED2();
    
    msg[0]=received;
    msg[1]=0x00;
    msg[2]=0x00;
   
    //msg[1] = (degC>>8)&0xFF;
    //msg[2] = volt;

    if (SMPL_SUCCESS == SMPL_Send(linkID1, msg, sizeof(msg)))
    {
      BSP_TOGGLE_LED2();
    }
    else
    {
      BSP_TOGGLE_LED2();
      BSP_TOGGLE_LED1();
    }
  }
}

#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{

while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
received = UCA0RXBUF; }

 

 

 

 

 

  • Hi,

    I don't understand what you mean by "trying to read from a JTAG port". The JTAG port is what you use to program the processor, I don't know how you could read that and then send data to the AP.

    From a quick peek at your code, I don't see how it sends any data to the AP. You set up the UART, enable the UART interrupt and then go into LPM3. In your UART ISR, you don't wake it up from LPM3 so when it exits the ISR it is still in LPM3 and will not execute the code that wakes up the radio and sends the data.

    Barry

  • Hi, Barry, 

    Sorry for the confusion. The board our company designed can already talk to the GUI. It uses Rx and Tx from the same port to program.

    I'm new to this topic. How do I wake it up from LPM3 in my code?

    Thank you a lot!

  • Hi,

    If you add the line __bic_SR_register_on_exit(LPM3_bits); to your ISR that will modify the SR on the stack and then when the ISR exits it will not be in LPM3 any more.

    One other thing about your ISR is that it appears you are checking to see if the transmit buffer is ready for data.  

    "while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?"

    This is usually done if you are echoing characters received and you want to ensure that last character sent out has gone out and it is safe to but the just received character into the transmit buffer. You don't appear to be doing that, so it's possible that your code could hang at that line of code.  Since no characters have been put in the transmit buffer, the flag indicating that the transmit buffer is ready will not be set.

    Barry

  • Thank you so much!!

    I think it's working now. When I change the GUI pages, I can tell from HyperTerminal that the data is changing!

    Now I need to change the Access Point Code and adjust it to our own communication protocol.

    Again, thank you!

**Attention** This is a public forum