Hello!
If you are using telosb motes then 57600 is not right.This is for mica
motes. Try replace it with 115200.
When I run motelist I get /dev/ttyUSBX, where X={1,2,3,4,...} and so, in
order to run the serial forwarder I run
$ java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSBX:115200 or
$ java net.tinyos.sf.SerialForwarder -comm serial@/dev/ttyUSBX:telosb
See this tutorial for further information:
http://docs.tinyos.net/tinywiki/index.php/Mote-PC_serial_communication_and_SerialForwarder
It explain the bauds and it has nice examples.
Best regards,
Georgia

On Wed, Jan 11, 2012 at 3:48 PM, Mubashir Rehmani <[email protected]>wrote:

> Hello Georgia,
>
> I need your help. I am facing the same problem but at the very earlier
> stage.
>
> Can you please give me suggestion to connect Telosb mote to the serial
> port (usb) of the PC?
>
> Infact, i first run the command:
> $ motelist
> I got, COM10 as the port of my USB.
>
> then i run,
> $ java net.tinyos.sf.SerialForwarder -comm serial@COM10:57600
>
> A java based application was opened and it showed me
>
> Listening to serial@COM10:57600
> Listening for client connections on port 9002
> serial@COM10:57600: resynchronizing
>
> I tried different baud rates (I am using Telosb) but still i am getting
> the same error.
>
> Kind Regards
>
> On 11 January 2012 14:44, Geo Gkolfin <[email protected]> wrote:
>
>> Hello!
>> I am trying to send some messages to the serial port in order to process
>> them with a java application. But something goes wrong, the java app does
>> not "see" the packets arriving to the serial port. So either I do not send
>> them to the serial port correctly or the java app is not correct. Or both.
>>
>> I am using a telosb mote connected to usb port which receives a message
>> every second. The mote sends another message over the radio and forwards
>> the received message (after some changes) to the serial port. In order to
>> send to the serial port I have written:
>>
>> module MineC{
>> ...
>> uses interface AMSend as UartAMSend;
>> uses interface Packet as UartPacket;
>> ...
>> }
>>
>> implementation{
>>     ...
>>     message_t packet_uart;
>>     ...
>>
>>     event message_t* RadioReceive.receive(message_t* msg, void* payload,
>> uint8_t len){
>>        ...
>>        MineMsg* pkt3=(MineMsg*)(call
>> UartPacket.getPayload(&packet_uart,sizeof(MineMsg)));
>>
>>        pkt3->id=u;
>>        pkt3->d=x;
>>        pkt3->c=y;
>>        pkt3->c2=z;
>>        pkt3->t=w;
>>        call UartAMSend.send(TOS_UART_ADDR,&packet_uart,sizeof(MineMsg));
>>        ...
>>     }
>>
>>     event void UartAMSend.sendDone(message_t* msg, error_t err){
>>         if(err==SUCCESS){
>>             printf("\n!!!MESSAGE SENT TO SERIAL PORT!!!\n");
>>         }else call
>> UartAMSend.send(TOS_UART_ADDR,&packet_uart,sizeof(CondMsg));
>>     }
>>
>> } //end of implementation
>>
>>
>> and at Mine.h I define TOS_UART_ADDR=0x007E. Also at MineAppC.nc I wire
>> the interfaces with the components. I compile and install the program and I
>> don't get any errors. If I run MsgReader tool I get:
>>
>> serial@/dev/ttyUSB4:115200: resynchronising
>> serial@/dev/ttyUSB4:115200: bad packet
>>
>> and then nothing. It does not exit either. If I run Listen tool I  a
>> packet per sec as expected. But the first second I get:
>>
>> serial@/dev/ttyUSB4:115200: resynchronising
>> 00 FF FF 00 00 1C 00 64 0A 49 20 61 6D 20 69 6E 74 6F 20 52 65 63 65 69
>> 76 65 21 21 21 0A 0A 7A 6F 6E 65 3D
>> 00 FF FF 00 00 1C 00 64 31 2C 20 74 65 6D 70 3D 30 2C 20 64 75 73 74 3D
>> 35 35 2C 63 6F 3D 31 39 30 30 2C 63
>> 00 FF FF 00 00 1C 00 64 6F 32 3D 35 39 32 0A 0A 0A 53 45 4E 44 3A 6C 65
>> 64 30 3D 30 0A 6C 65 64 31 3D 31 0A
>> 00 FF FF 00 00 1C 00 64 0A 0A 46 4F 52 20 53 45 52 49 41 4C 3A 7A 6F 6E
>> 65 3D 31 2C 20 74 65 6D 70 3D 30 2C
>> 00 FF FF 00 00 1C 00 64 20 64 75 73 74 3D 35 35 2C 63 6F 3D 31 39 30 30
>> 2C 63 6F 32 3D 35 39 32 0A 0A 21 21
>> 00 FF FF 00 00 1C 00 64 21 4D 45 53 53 41 47 45 20 53 45 4E 54 21 21 21
>> 0A 0A 21 21 21 4D 45 53 53 41 47 45
>> 00 FF FF 00 00 1C 00 64 20 53 45 4E 54 20 54 4F 20 53 45 52 49 41 4C 20
>> 50 4F 52 54 21 21 21 0A 00 00 00 00
>>
>> and then every second I get these 7 lines:
>>
>> 00 FF FF 00 00 1C 00 64 0A 49 20 61 6D 20 69 6E 74 6F 20 52 65 63 65 69
>> 76 65 21 21 21 0A 0A 7A 6F 6E 65 3D
>> 00 FF FF 00 00 1C 00 64 31 2C 20 74 65 6D 70 3D 30 2C 20 64 75 73 74 3D
>> 35 33 2C 63 6F 3D 31 39 30 30 2C 63
>> 00 FF FF 00 00 1C 00 64 6F 32 3D 35 39 32 0A 0A 0A 53 45 4E 44 3A 6C 65
>> 64 30 3D 30 0A 6C 65 64 31 3D 31 0A
>> 00 FF FF 00 00 1C 00 64 0A 0A 46 4F 52 20 53 45 52 49 41 4C 3A 7A 6F 6E
>> 65 3D 31 2C 20 74 65 6D 70 3D 30 2C
>> 00 FF FF 00 00 1C 00 64 20 64 75 73 74 3D 35 33 2C 63 6F 3D 31 39 30 30
>> 2C 63 6F 32 3D 35 39 32 0A 0A 21 21
>> 00 FF FF 00 00 1C 00 64 21 4D 45 53 53 41 47 45 20 53 45 4E 54 21 21 21
>> 0A 0A 21 21 21 4D 45 53 53 41 47 45
>> 00 FF FF 00 00 1C 00 64 20 53 45 4E 54 20 54 4F 20 53 45 52 49 41 4C 20
>> 50 4F 52 54 21 21 21 0A 00 00 00 00
>>
>> That does not seem correct, since the MineMsg is small:
>>
>>  typedef nx_struct mine_msg{
>>      nx_int16_t id;
>>      nx_int16_t d;
>>      nx_int16_t c;
>>      nx_int16_t c2;
>>      nx_int16_t t;
>>  } MineMsg;
>>
>> and also it's payload should be different every second. Any ideas what do
>> I do wrong? I am on tinyos -2.1.0.
>> Thank you all in advance!
>> Georgia
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
>
>
>
> --
> Mubashir Husain Rehmani
>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to