EmbeddedRelated.com
Forums
Memfault Beyond the Launch

MSP430-RF2500 reading a packet problem

Started by Kostas Panagiotakis July 23, 2012
Hello my name is Kostas and I want to ask you a question regarding the MSP430 eZ430-RF2500 development tool.
I'm trying to send a packet,from one board to another, by pressing the on board button. The packet contains the letter "A". When the packet is received I want to check if it contains the letter and if it does, to turn on the red light on the board. The problem is that I cannot read the contents of the packet thus, I cannot perform the check. Below is the code that I'm using to perform this task. What should I do to fix this problem?
Thanks in advance.
#include "mrfi.h"
#include "radios/family1/mrfi_spi.h"

int main()
{
BSP_Init();
P1REN |= 0x04;
P1IE |= 0x04;
MRFI_Init();
MRFI_WakeUp();
MRFI_RxOn();
__bis_SR_register(GIE+LPM4_bits);
}

void MRFI_RxCompleteISR()
{
mrfiPacket_t packet;
MRFI_Receive(&packet);
if (packet.frame[0]=='A'){
P1OUT ^= 0x02;
}
}

#pragma vector=PORT1_VECTOR

__interrupt void Port_1()
{
P1IFG &= ~0x04;
char rx='A';
mrfiPacket_t packet;
packet.frame[0]=rx;
MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED);
P1OUT ^= 0x01;
}



Beginning Microcontrollers with the MSP430

Kostas Panagiotakis wrote:
> void MRFI_RxCompleteISR()
> {
> mrfiPacket_t packet;
> MRFI_Receive(&packet);
> if (packet.frame[0]=='A'){
no
> P1OUT ^= 0x02;
> }
> }
>
> #pragma vector=PORT1_VECTOR
>
> __interrupt void Port_1()
> {
> P1IFG &= ~0x04;
> char rx='A';
> mrfiPacket_t packet;
> packet.frame[0]=rx;
no
> MRFI_Transmit(&packet, MRFI_TX_TYPE_FORCED);
> P1OUT ^= 0x01;
> }

It looks like you have just copied code from the net, and used it with
assumptions. You need to read about how to build a packet or at least
use an example doing such. A packet is composed of a header, payload,
and payload size. frame[0] is *not* for payload data.

If you don't bother to understand the libraries you intend to use, you
will waste a great deal of time with a shotgun.

Best, Dan.

--
"If they can get you asking the wrong questions, they dont
have to worry about answers."

-- Thomas Pynchon


Memfault Beyond the Launch