I'm actually surprised you see anything at all......
You can't use USART0 to communicate with the PC because it isn't
physically connected to the serial port on the telos -- there are no
wires connecting USART0 to the USB controller to exchange data with
the PC.

USART0 is attached to the radio, the flash, and the external connector
pins, while USART1 is attached to the serial port.

As a side note......
You should consider using something other than while() loops in the
way that you do if you actually start implementing something
substantial in TinyOS.  Because of the concurrency model that TinyOS
uses, using while() loops to wait on a flag without really knowing
what you are doing could cause your program to lock up and never break
out of the loop.  Using a split-phase operation is preferred.  Just a
word of caution for anyone considering doing this.

Kevin

On 10/4/07, Vaibhav Nagarnaik <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I am trying to use tinyos 2.x with telosb to communicate with PC using UART0.
>
> I have tried different components Msp430Usart0C and Msp430Uart0C but I don't 
> receive the same character sent from PC.
>
> For example if I send 'a' from PC, I get '0x58 0x08 0x01 0x00' ie four 
> characters on the PC. Even when the code explicitly sends 1 byte.
>
> I have set baud rate on the PC to 57600. If I run the same code using 
> Msp430Usart1C component, there is no problem.
>
> Can anyone please point me to the problem in this code?
>
> Following is the sample code I am trying to run.
>
> configuration TestSerialAppC {}
> implementation {
>     components TestSerialC as App, MainC, LedsC;
>
>     components new Msp430Usart0C() as usart0;
>
>     App.Boot -> MainC;
>     App.Leds -> LedsC;
>
>     App.usart -> usart0;
>     App.UsartResource -> usart0;
> }
>
> module TestSerialC {
>     uses {
>         interface HplMsp430Usart as usart;
>         interface Boot;
>         interface Resource as UsartResource;
>         interface Leds;
>     }
> }
>
> implementation {
>     event void Boot.booted() {
>         while (call UsartResource.request() != SUCCESS);
>     }
>     event void UsartResource.granted() {
>         uint8_t data;
>         call usart.setModeUart(&msp430_uart_default_config);
>         call usart.enableUart();
>
>         while (1) {
>             call Leds.led1On();
>             while (! call usart.isRxIntrPending());
>             call Leds.led1Off();
>
>             data = call usart.rx();
>             call usart.clrRxIntr();
>
>             call Leds.led0On();
>             call usart.tx(data);
>
>             while (! call usart.isTxEmpty());
>             if (call usart.isTxIntrPending()) {
>                 call usart.clrTxIntr();
>             }
>             call Leds.led0Off();
>         }
>     }
> }
>
>
>
> Any help is appreciated.
>
> Vaibhav
>
>
>
>
>
>
>
>
>
> ____________________________________________________________________________________
> Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for 
> today's economy) at Yahoo! Games.
> http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>


-- 
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to