Hi,

Thanks for your reply. I am sorry if I missed telling that I am using
motes similar to Micaz in Tinyos-2.0.2 and Cygwin. The UART used here
for Atmega128 is UART1. It is not used for Flash or Radio but is used
only for serial communication. I am currently able to correctly do
communication with the PC where as I want to attach a 7-segment LED
screen to the serial port instead of a PC. I read the complete hardware
specifications of both my motes and the serial cable attached to the LED
screen. What the LED screen is EXPECTING is data on a single pin (RXD on
led screenside) which should be connected to the TXD1 of the Atmel
processor. Now my atmel atmega128 is connected to a RS-232 driver chip
which is expecting RTS, CTS, TXD1 and RXD1, so my first question is if I
use UartStream.send , will it just send the data to the TXD1 pin or do
we need to send the complete control signals as my LED board is not
expecting the control signals??? I went on to look the PlatformSerialC
for my platform, it connects to Atm128Uart correctly and
HplAtm128UartP,, so that should not be a problem. The next thing is that
the my LED screen is expecting commands like as follows:

 

[uid] ['a'/'b'...] [digit 1] [digit 2] [digit 3] [digit 4]

 

Where:

the uid preprogrammed is 255,so to send the equivalent ascii is a space,
'a' means turn on all the 4 LED's and digit1 is say '1',etc etc.

 

So, what I am trying to do is something like this:

 

Event void some_event() {

                call SendUartStream.send(" a1234",6);

}

 

async event void SendUartStream.sendDone(uint8_t* buffered, uint16_t
len, error_t ok) {

                if (ok == SUCCESS) {

                                call Leds.led0Toggle();

    }

  }

  

  async event void SendUartStream.receivedByte(uint8_t byte)

                {

                                char string[] = " a1234";

                                call SendUartStream.send(string,6);

                                call
SendUartStream.disableReceiveInterrupt();

                }

 

  async event void 

                SendUartStream.receiveDone(uint8_t *buf, uint16_t len,
error_t error)

                {

                                call SendUartStream.send(buffer,6);

                }

 

NOW I HAVE been able to get over with the errors sent earlier by
declaring the receivedByte and receiveDone events (though, I do not
still understand why we need to do this when we do not want to receive
any byte, all I want is to just send the bytes to the UART), but the
error is fixed, so I am trying to first get the LED screen working, but
its not working. AM I using the UartStream.send incorrectly or am I
missing something??? IS THERE something more that is needed to be done
for using the UartStream??

 

Guillermo: I tried searching for the code you mention but could not
find, I am not using Msp430 controller so, I do not have to request a
resource, the resource is always mine.

 

I hope I was able to explain my issue, please let me know if you people
need more info for helping me out here..

 

Cheers,

Varun Jain

 

 

From: Guillermo De Cesco [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 30, 2008 10:47 PM
To: [email protected]
Cc: Varun Jain
Subject: [Tinyos-help] error using UartStream......

 

Hi all,

For all the ones that wants to use uart communication in tmote, some
things have to be taken in consideration:
-What uart do you want to use, UART1 is the uart associated with USB
communication so this isn't the one you want to use probably. UART0 is
the one exported in the expansion pin connector, but is also shared as a
SPI bus with stm25p flash and cc2420 radio chips.
-What type of communication you intend to establish, i.e just send bytes
to uart, just receive, receive in response to a sent command, or send
and receive in a full duplex manner were the receive is not correlated
to the send event.

Taken this things into account one cant do the following:
-In the case that you use UART1 there is no problem at all, I mean you
remove the usb or what ever but you have access to the uart, there is no
conflict chip intervening in this uart.
For the case you use UART0, the most common case:
-For just  sending:
    - you have to request the resource
    - when granted the resource send your bytes.
    - when send done release the resource.
-For just receive or send and receive asynchronously do the same:
   - request the resource at boot
   - own the resource for ever. YOU WON'T BE ABLE TO USE FLASH NOR RADIO
-For receive that is correlated in time with the send:
   - request the resource.
   - when granted the resource send your bytes.
   - when send done done nothing.
   - wait until the receive is done.
   - then release resource.
In this last configuration you would be able to use flash and radio.

For Varun:
In your case you have some compile errors in using the interface because
you don't wire all the events the interface provides. I almost sure
PlatformSerialC and TelosSerial in particular modules are related to
UART1 means USB at 115200 and other parameter set, where are you
connecting your leds?.I had posted other mail response in July 2008 were
I copy/paste example code on how to do this, in particular the case were
ones request the resource for ever, you only have to add the release of
the resource when you no longer need it.

mail me if isn't clear enough, or you have another question. to do this
add my mail in the cc, so it would be in the mailing list for others to
get an answer, just like i did in this mail.

-Bill





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

Reply via email to