Hi,

I'm using tmote sky. I want to exchange data between 2 motes over the
UART0 bus of expansion connector. I've connected the 2 grounds
together and connected UART0TX of 1st mote to UART0RX of other mote
and vice versa.

I'm able to use the sample given in
http://www.moteiv.com/community/Boomerang_UART0_Sample to send data
over UART0 keeping in mind shared bus.

But I am unable to receive data at the other mote. I've written code
which handles a rxdone event. But i'm not clear what the error is and
can't find sufficient documentation for the same. I'd be thankful for
some guidance on the code.

Bhavish

The code to receive is as under:

UART0Rx:
configuration UART0Rx {
}
implementation {
  components SPC
    , LedsC
    , new MSP430ResourceUART0C() as ResourceCmdC
    , HPLUSART0M
    , Main
    , UART0RxP
    ;

  Main.StdControl -> UART0RxP;
  UART0RxP.ResourceCmd -> ResourceCmdC;
  UART0RxP.UartControl -> HPLUSART0M;
  UART0RxP.Leds -> LedsC;
}

UART0RxP:
module UART0RxP{
  provides{
    interface StdControl;
  }
  uses{
    interface ResourceCmd;
    interface Leds;
    interface HPLUSARTControl as UartControl;
    interface HPLUSARTFeedback as UartFeedback;
  }
}

implementation{

  uint8_t data = 'z';

  command result_t StdControl.init(){
    return SUCCESS;
  }

  async event result_t UartFeedback.rxDone(uint8_t rxdata){
    call Leds.yellowOn();
    call ResourceCmd.release();
  }

  async event result_t UartFeedback.txDone(){}

  event void ResourceCmd.granted(uint8_t rh) {
    call UartControl.setClockSource(SSEL_2);
    call UartControl.setClockRate(UBR_SMCLK_9600, UMCTL_SMCLK_9600);

    call UartControl.enableUARTRx();

    if((call UartControl.enableRxIntr())){
      call Leds.redOn();
    }

    if((call UartControl.isUARTrx())){
      call Leds.greenOn();
    }

    while(data != 0x12){
      data = call UartControl.rx();
    }
  }

  command result_t StdControl.start(){
    call ResourceCmd.request( RESOURCE_NONE );

    return SUCCESS;
  }

  command result_t StdControl.stop(){
    return SUCCESS;
  }
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to