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.

reduce the time elapsed of function MRFI_Transmit

Hi 

I am using a ez430-RF2500 to build up a wireless communication link. The following code is the code I used to test the time used to transmit data.

 

#include "radios/family1/mrfi_spi.h"

#include "mrfi.h"

 

mrfiPacket_t packetToSend;

 

int main(void)

{

  BSP_Init();

 

  //Use Pin5 (port2.2 for timing measurement)

  P2DIR |= 0x04;

 

  P1REN |= 0x04;

  P1IE |= 0x04;

 

  MRFI_Init();

  mrfiSpiWriteReg(PATABLE,0xBB);

  mrfiSpiWriteReg(PKTCTRL0,0x41);

 

  P3SEL    |= 0x30;

  UCA0CTL1  = UCSSEL_2;

  UCA0BR0   = 0x41;

  UCA0BR1   = 0x3;

  UCA0MCTL  = UCBRS_2;                     

  UCA0CTL1 &= ~UCSWRST;

 

  MRFI_WakeUp();

  MRFI_RxOn();

  __bis_SR_register(GIE+LPM4_bits);

}

 

void MRFI_RxCompleteISR()

{

  uint8_t i;

  P1OUT ^= 0x02;

  mrfiPacket_t packet;

  MRFI_Receive(&packet);

  char output[] = {"111222333444555666777888\r\n"};

  for (i=9;i<packet.frame[0];i++) {

    output[i-9]=packet.frame[i];

  }

  TXString(output, (sizeof output));

}

 

#pragma vector=PORT1_VECTOR

__interrupt void Port_1 (void)

{

  P1IFG &= ~0x04;

  packet.frame[0]=8+24; //8 bytes header, 24 bytes payload

    //Channel 1

    packet.frame [9] = "a";

    packet.frame [10] = "a";

    packet.frame [11] = "a";

 

    //Channel 2

    packet.frame [12] = "b";

    packet.frame [13] = "b";

    packet.frame [14] = "b";

 

    //Channel 3 

    packet.frame [15] = "c"; 

    packet.frame [16] = "c";

    packet.frame [17] = "c";

 

    //Channel 4 

    packet.frame [18] = "d";

    packet.frame [19] = "d";

    packet.frame [20] = "d";

 

    //Channel 5

    packet.frame [21] = "e";

    packet.frame [22] = "e";

    packet.frame [23] = "e";

 

    //Channel 7

    packet.frame [24] = "f";

    packet.frame [25] = "f";

    packet.frame [26] = "f";

 

    //Channel 8

    packet.frame [27] = "g";

    packet.frame [28] = "g";

    packet.frame [29] = "g";

 

    //Channel 8

    packet.frame [30] = "h";

    packet.frame [31] = "h";

    packet.frame [32] = "h";

    P2OUT |= 0x04;

  MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED);

    P2OUT &= ~0x04;

  P1OUT ^= 0x01;

}

Therefore, I measure the time using oscilloscope to see the ON time of P2.5. However I notice that to transmit 3 byte payload with 500kBaud, it needs about 1.3ms, for 24 byte payload, it needs 1.74ms. 

May I somehow reduce this time please?

I have looked into the function MRFI_Transmit, and apart from delete a IF statement, I don't know how can I reduce the size of the code. Also I noticed that changing the SPI clock from 4MHz to 8MHz doesn't reduce the time by a lot.

Thanks