[Tinyos-help] Problems with nx_union in TestSerial and sim-sf on T2

2008-07-12 Thread Federico Porceddu
 Hi All,
i'm trying to use TestSerial on Tossim (compiling with make micaz sim-sf )
I modified the TestSerial.h in this way:
...
typedef nx_struct test_serial_msg {
  nx_uint16_t counter;
  nx_union {
nx_uint8_t a;
nx_uint32_t b;
  } prova_t;
} test_serial_msg_t;

...

I've tried to send messages with the java application TestSerial.java.
I made the interface to the message structure with the mig tool like follow:

mig java -target=null  -java-classname=TestSerialMsg TestSerial.h
test_serial_msg -o TestSerialMsg.java

mig java -target=null  -java-classname=TestSerialMsg TestSerial.h
test_serial_msg -o TestSerialMsg.py

the first one for java application and the second one for python script for
Tossim.

Sending messages from the TestSerialC.nc to Java application works well, but
i have some problems in receiving messages from Java to TestSerialC.nc:

Always, SerialActiveMessage.nc receives serial messages but the
TestSerialC.nc sometimes signals the Receive. Receive, sometimes no.
For Example:

if Java Application send
Sending packet 0
sent:00 00 00 00 00 06 00 89 00 00 00 00 00 00

the TestSerial.py always receives something (there is debug in
tinyos-2.x/tos/lib/tossim/sf/sim/SerialActiveMessageC.nc, i added just the
dbg of the message)

In this case:
DEBUG (0): Received serial message (0x191ea23c) of type 137 and length 6 @
0:0:4.367578128 //dbg from SerialActiveMessageC.nc
receive:00 00 00 00 00 06 00 89 00 00 00 00 00 00
DEBUG (0): Messaggio Ricevuto : 0:0:4.367578128 //dbg from TestSerialC.nc

In other case:
DEBUG (0): Received serial message (0x191ea23c) of type 97 and length 157 @
0:0:5.390625000
9d 14 61 dc 9d 14 61 00 02 00 00 00 00 d9 00 18 00 00 00 5a 01 00 00  00 00
00 00 e8 a4 f2 7f fe ff ff ff 00 00 00 00 90 bd b8 6c 03 00 00 00 74 a5 d9
00 b0 90 f3 7f 24 38 f6 7f 5c 83 f2 7f 00 00 00 00 78 22 ee 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 0b d9 00 0c 00 00 00
c6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

and it doesn't signal the Receive. Receive. (so message is not received from
my TestSerialC.nc).
Randomly sometimes works like in the first case, sometimes like the second
case.
is there a problem with nx_union..? or in the Tossim?
Can i use nx_union in the message definition like i do?
Thanks in advance.
Ciao
-- 
~
Federico Porceddu
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Re: [Tinyos-help] Problems with nx_union in TestSerial and sim-sf on T2

2008-07-14 Thread Stefano "Kismet" Lenzi
On Sat, Jul 12, 2008 at 18:36, Federico Porceddu
<[EMAIL PROTECTED]> wrote:
> Hi All,
> i'm trying to use TestSerial on Tossim (compiling with make micaz sim-sf )
> I modified the TestSerial.h in this way:
> ...
> typedef nx_struct test_serial_msg {
>   nx_uint16_t counter;
>   nx_union {
> nx_uint8_t a;
> nx_uint32_t b;
>   } prova_t;
> } test_serial_msg_t;
>
> ...
>
> I've tried to send messages with the java application TestSerial.java.

Does the original  TestSerial works on TOSSIM ?

>
> In this case:
> DEBUG (0): Received serial message (0x191ea23c) of type 137 and length 6 @
> 0:0:4.367578128 //dbg from SerialActiveMessageC.nc
> receive:00 00 00 00 00 06 00 89 00 00 00 00 00 00
> DEBUG (0): Messaggio Ricevuto : 0:0:4.367578128 //dbg from TestSerialC.nc
>
> In other case:
> DEBUG (0): Received serial message (0x191ea23c) of type 97 and length 157 @
> 0:0:5.390625000
> 9d 14 61 dc 9d 14 61 00 02 00 00 00 00 d9 00 18 00 00 00 5a 01 00 00  00 00
> 00 00 e8 a4 f2 7f fe ff ff ff 00 00 00 00 90 bd b8 6c 03 00 00 00 74 a5 d9
> 00 b0 90 f3 7f 24 38 f6 7f 5c 83 f2 7f 00 00 00 00 78 22 ee 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 0b d9 00 0c 00 00 00
> c6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>
> and it doesn't signal the Receive. Receive. (so message is not received from
> my TestSerialC.nc).

Does it mean that TOSSIM receive the message that you sent with the
TestSerail JAVA program, but the data received on the simulated node
on TOSSIM doesn't seem correct and it is discarded beacuse the packet
type is not the one expected by the node?

I think that the problem may rely on either:
 - The implementation of the communication channel between TOSSIM e Java
 - The implementation of the serialization of Packet used for Python
and Java message

> Randomly sometimes works like in the first case, sometimes like the second
> case.
> is there a problem with nx_union..? or in the Tossim?
> Can i use nx_union in the message definition like i do?

I hope that some TOSSIM and MIG expert may better clarify your doubts

> Thanks in advance.
> Ciao
> --
> ~
> Federico Porceddu
> ___
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] Problems with nx_union in TestSerial and sim-sf on T2

2008-07-16 Thread Federico Porceddu
Hi All,

On Mon, Jul 14, 2008 at 7:32 PM, Stefano Kismet Lenzi <[EMAIL PROTECTED]>
wrote:

> On Sat, Jul 12, 2008 at 18:36, Federico Porceddu
> <[EMAIL PROTECTED]> wrote:
> > Hi All,
> > i'm trying to use TestSerial on Tossim (compiling with make micaz sim-sf
> )
> > I modified the TestSerial.h in this way:
> > ...
> > typedef nx_struct test_serial_msg {
> >   nx_uint16_t counter;
> >   nx_union {
> > nx_uint8_t a;
> > nx_uint32_t b;
> >   } prova_t;
> > } test_serial_msg_t;
> >
> > ...
> >
> > I've tried to send messages with the java application TestSerial.java.
>
> Does the original  TestSerial works on TOSSIM ?


Yes, it work. I just add the nx_union. I did not modified TOSH_DATA_LENGTH
because it is just 6 bytes
and the payload size in serial message is 12 bytes (right?)
But i made another test. I don't know where is the proble,
but in the original TestSerial.h

typedef nx_struct test_serial_msg {
  nx_uint16_t counter;
} test_serial_msg_t;

i modify just nx_uint16_t counter; to *nx_uint32_t* counter (so 4 bytes);

typedef nx_struct test_serial_msg {
  *nx_uint32_t *counter;
} test_serial_msg_t;

i make another time mig files for python and java, recompile java, run
application
and there is the same problem!!
is there a problem with serial messages on TOSSIM and  *nx_uint32_t* ??

> >
> > In this case:
> > DEBUG (0): Received serial message (0x191ea23c) of type 137 and length 6
> @
> > 0:0:4.367578128 //dbg from SerialActiveMessageC.nc
> > receive:00 00 00 00 00 06 00 89 00 00 00 00 00 00
> > DEBUG (0): Messaggio Ricevuto : 0:0:4.367578128 //dbg from TestSerialC.nc
> >
> > In other case:
> > DEBUG (0): Received serial message (0x191ea23c) of type 97 and length 157
> @
> > 0:0:5.390625000
> > 9d 14 61 dc 9d 14 61 00 02 00 00 00 00 d9 00 18 00 00 00 5a 01 00 00  00
> 00
> > 00 00 e8 a4 f2 7f fe ff ff ff 00 00 00 00 90 bd b8 6c 03 00 00 00 74 a5
> d9
> > 00 b0 90 f3 7f 24 38 f6 7f 5c 83 f2 7f 00 00 00 00 78 22 ee 00 00 00 00
> 00
> > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 0b d9 00 0c 00 00 00
> > c6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 00
> > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> >
> > and it doesn't signal the Receive. Receive. (so message is not received
> from
> > my TestSerialC.nc).
>
> Does it mean that TOSSIM receive the message that you sent with the
> TestSerail JAVA program, but the data received on the simulated node
> on TOSSIM doesn't seem correct and it is discarded beacuse the packet
> type is not the one expected by the node?


Yes, randomly  Packet Type and Lenght are not right, so they are discarded.


>
> I think that the problem may rely on either:
>  - The implementation of the communication channel between TOSSIM e Java
>  - The implementation of the serialization of Packet used for Python
> and Java message
>
> > Randomly sometimes works like in the first case, sometimes like the
> second
> > case.
> > is there a problem with nx_union..? or in the Tossim?
> > Can i use nx_union in the message definition like i do?
>
> I hope that some TOSSIM and MIG expert may better clarify your doubts


Yes, I hope that someone can help me :)
Thanks in advance.
~~~
Federico Porceddu
___
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help