0

Module does not receive data through UART, help with TinyOS

Postby Telosb ยป Tue Jul 15, 2014 6:47

Dear Memebers,

i am new to the tinyos programming. I am working with the KMoteB from:

http://www.tinyosmall.com/product_p/100-101.htm

I use the YETI2 Plugin and the TinyOS compiler.

The problem is, that if i send data via printf through the Serial Interface to the computer, i am able to receive it as sended. On the other hand the PC-to-Mote Communication does not work. The RX LED light up, but the data, for example the 'u' send through ubuntu does not trigger the receive event.

    event message_t* UartReceive.receive(message_t* bufPtr, void* payload, uint8_t len)
    {
        call Leds.led2On();
        printf("Receive\n");
        printfflush();
        return bufPtr;
    }

I am trying to implement this Code:

http://embedntks.com/tinyos-uart-sending-raw-data/

Does anyone know where the problem might be?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
KmoteB
  • 1
  • 1

1 Answers1

0

How do you send a data from a PC to a mote? From your description I assume you just send raw bytes using, for instance, the minicom application. This approach won't work. TinyOS will receive only whole packets containing header, payload and footer. To send such, you need to write a Java application on a PC side. Have a look at the chapter "Mote-PC communication" in this tutorial: http://csl.stanford.edu/~pal/pubs/tos-programming-web.pdf.

Another issue is that you use Receive interface together with printf function. The aforementioned tutorial states that "packets sent from a PC to a mote are acknowledged by the mote". They're acknowledged, of course, using the serial communication too. This may lead to such problem: the TinyOS PrintfClient has to receive and process printf data whereas your java application has to receive and process acknowledgements. From my experience, if you use printf in your application, you can't use the serial communication stack because the PrintfC module owns and uses it. You can send your custom packets to a PC when a receive event occurs and process them by a Java application.

maral
  • 1,431
  • 1
  • 10
  • 15