Hello ,
The reason I was asking about the data rates in previous email is
described below.
I have a bluetooth module that acts as a serial link. I have hooked up
this module on the UART 0 of a tmote. Now I want to receive packets
from another mote that is sending data ( a simple counter) and send it
over to the bluetooth module ( by writing on to the UART0) . I tested
it with the TestUart0 (sample program from MoteIV boomerang) where the
mote is just writing some data by itself to the uart port and at the
same time sending a packet on the CC2420 - it works with that pretty
fine. I am able to get data with this setup from the bluetooth module.
But when I want to listen on the other sender mote and then send the
contents of that packet - it doesn't work.
These are my questions:
1. Do I also have to use CC2420ResourceC ?
2. What am I doing wrong here ? This code somehow seems that I am
missing something.
3. Is there something else I need to use ?
I have attached my code below. I have modified the TestUART0 slightly
to include the receive part from the CC2420. Can somebody review the
code below and point me the mistakes? I am using Boomerang Stack from
MoteIV.
Thanks,
Somnath
//////////////////////////////////////////////////////////////////// config
configuration TestUart0 {
}
implementation {
components SPC
, new MSP430ResourceUART0C() as ResourceCmdC
, LedsC
, HPLUSART0M
, GenericComm
, Main
, TestUart0P
;
Main.StdControl -> TestUart0P;
Main.StdControl -> GenericComm;
TestUart0P.ResourceCmd -> ResourceCmdC;
TestUart0P.UartControl -> HPLUSART0M;
TestUart0P.Leds -> LedsC;
TestUart0P.ReceiveMsg -> GenericComm.ReceiveMsg[AM_COUNT_MSG];
}
////////////////////////////////////////////////////////////////// module
module TestUart0P {
provides {
interface StdControl;
}
uses {
interface ResourceCmd;
interface ReceiveMsg;
interface HPLUSARTControl as UartControl;
interface Leds;
}
}
implementation {
TOS_Msg m_tosmsg;
uint8_t UART_TX_BYTE;
char c;
event void ResourceCmd.granted(uint8_t rh) {
// I now have the UART and it is in UART mode.
call Leds.yellowOn();
// Make any necessary UART changes
call UartControl.setClockSource(SSEL_2);
call UartControl.setClockRate(UBR_SMCLK_9600, UMCTL_SMCLK_9600);
// Send data
c = UART_TX_BYTE;
atomic call UartControl.tx( c );
while (! call UartControl.isTxEmpty() ) ;
call Leds.yellowOff();
// Release the resource
call ResourceCmd.release();
call Leds.redOff();
}
event TOS_MsgPtr ReceiveMsg.receive( TOS_MsgPtr msg )
{
CountMsg_t* body = (CountMsg_t*)msg->data;
atomic UART_TX_BYTE = body->counter;
call Leds.redOn();
call ResourceCmd.request( RESOURCE_NONE );
return msg;
}
command result_t StdControl.init()
{
UART_TX_BYTE = 0x61;
return SUCCESS;
}
command result_t StdControl.start() {
call Leds.greenOn();
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