You can also look at the example that I placed in CVS contrib (tinyos-1.x/contrib/SharedUSART/). This example switches between UART and SPI mode and allows you to transmit and receive bytes to a UART0 device over the radio. This is an example and has limitations so read the README file.
Chris
On 4/23/06, Hemanth Haridas <[EMAIL PROTECTED]> wrote:
I am trying to send data to UART0(expansion pin) but it gets sent to
UART1 (USB, connected to the computer). I am posting my code here what
am I doing wrong?. Any help would be highly appreciated. If anybody
would lead me to a fragment of code that sends data to UART on the
expansion connector, it would be great. The code I have writted (pasted
below) seems to send data to USB(UART1) , I havent been able to test
whether it also sends it to UART) on the expansion connector.
configuration file
UartLink.nc
configuration UartLink {
}
implementation {
components Main, UartLinkM,HPLUART0C;
Main.StdControl -> UartLinkM;
UartLinkM.Comm0 -> HPLUART0C.UART;
//Whatever I link UartLinkM.Comm0 with HPLUART0C or HPLUARTC, data gets
sent to UART1
}
UartLinkM.nc
module UartLinkM {
provides interface StdControl;
uses {
interface HPLUART as Comm0;
}
}
implementation {
uint8_t dataToSend;
command result_t StdControl.init() {
call Comm0.init();
return SUCCESS;
}
command result_t StdControl.start() {
dataToSend = 0;
call Comm0.put(dataToSend);
return SUCCESS;
}
command result_t StdControl.stop() {
call Comm0.stop();
return SUCCESS;
}
async event result_t Comm0.get(uint8_t data) {
return SUCCESS;
}
async event result_t Comm0.putDone() {
call Comm0.put(dataToSend++);
return SUCCESS;
}
}
HPLUART0.nc
configuration HPLUART0C {
provides interface HPLUART as UART;
}
implementation
{
components HPLUARTM, HPLUSART0M as HPLUSART;
UART=HPLUARTM;
HPLUARTM.USARTControl -> HPLUSART;
HPLUARTM.USARTData -> HPLUSART;
}
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
