Hi Mario,

The default event is indeed only called if no wiring has been specified. 
This could have two reasons: (1) you have a wiring problem (as you 
suggested), or (2) or the type of the message (the value in the square 
brackets [] before the function parameters) is not the expected value.

Personally, since this is not a value that you specify yourself in the 
code, I'd go with option (2). In SerialActiveMessageC the 
SerialDispatcherC.Receive is wired for TOS_SERIAL_ACTIVE_MESSAGE_ID, 
which is defined in Serial.h as 0. Without spending more time analyzing 
the code I think this means the following. The framing protocol used by 
the serial connection supports multiplexing different types of messages 
(why ever they would need this). The ID of the messages used for TinyOS 
communication is 0, your PC-based code could be sending a frame type 
different from 0.

Ok, I looked a bit more into it:

Byte 2 (Framer-level dispatch) is set to 0x45 = 69 = 
SERIAL_PROTO_PACKET_ACK, which is the only frame type that is handled 
(see SerialP.nc).

Byte 3 (as expected in SerialP.nc) seems to be a sequence number (so 
make sure to increment it :-) ).

(here you seem to miss a byte in your list)

Byte 4  is the frame data type If my reading of the source code is 
correct, this value would need to be 0 (TOS_SERIAL_ACTIVE_MESSAGE_ID).

Byte 5-6: destination address (see Serial.h, serial_header)

Byte 7-8: source address (see Serial.h, serial_header)

Byte 9: length (see Serial.h, serial_header)

Byte 10 would be the group ID (see serial_header in Serial.h). The group 
ID is used to logically separate different sensor networks sharing the 
same radio channel.

Byte 11: AM type (see Serial.h, serial_header)


Let me know whether inserting the missing Byte 4 (frame data type) with 
a value of 0 solves your problems (you might need to update the checksum).

Cheers,
Urs


On 10/22/2010 12:40 PM, Mario Riesner wrote:
> Hi Urs,
>
> the official baud rate is 57600 but the AVR ATMega1281 on my platform 
> (Meshbean) should use double rate for the UART but the controller does not 
> use double rate even though the flag is set (should be set??). I think the 
> accuracy at 57600 is not high enough. Using the baud rate 38400 the error 
> (jitter) is less and it works. The modules uses a RC oscillator instead of a 
> crystal this circumstances affects less clock accuracy.
>
> Now the received data and the signaled event ends in the
> default event message_t *Receive.received[uart_id_t idxxx](message_t *msg, 
> void *payload, unit8_t len)
> in the file: SerialDispacherP.nc
>
> I expected an signaled event in my testSerialC.nc at the line:
> event message_t *Receive.receive(message_t * bufPtr, void * payload, uint8_t 
> len)
>
> How can I signal my Receive.receive event? Or should I use an other received 
> event?
> Is it a wiring problem?
>
> Cheers,
> Mario
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to