Module does not receive data through UART, TinyOS Progeamming

偶尔善良 提交于 2019-12-12 04:56:06

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/24756760/module-does-not-receive-data-through-uart-tinyos-progeamming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!