You are right.
I would like to call an IP receiver from the 15.4-receiver and the UDP
receiver from the IP receiver but I don't know which components should
I use for the IP receiver. I think is the only way that I have.
I'm looking at IPDispatch in order to understand how protocol-stack
receivers work when a mote has to forward a packet. Should I call the
UDPReceiver from an IPReceiver? Once modified UDP payload in
UDPReceiver how can I put the UDP packet in the IPpayload and ensure
that the packet is forwarded as the routing usually do?
If you can point me or give me a suggestion about ip layer receiver or
udp forwarding, I will really appreciate.
Many thanks
Davide
>> // PAYLOAD RECEIVED IN CC2420 RECEIVER
>> typedef nx_struct Udp_PaKet{
>> nx_uint32_t part1;
>> nx_uint32_t part2;
>> nx_uint32_t part3;
>> nx_uint16_t part4;
>>
>> nx_uint8_t idrssi;
>> nx_uint16_t rssi;//nx_uint8_t
>> nx_uint8_t idlqi;
>> nx_uint16_t lqi;//nx_uint8_t
>>
>> } Udp_PaKet;
On 14/lug/10, at 22:09, Stephen Dawson-Haggerty wrote:
> You can't really mix L2 frames (Receive interface, Ieee154Message) and
> UDP packets like that. You don't even know where the payload is in
> the received frame, and so you're really just overwriting the frame
> randomly -- it's no surprise that the checksum is invalid and the
> network stops working. In fact, you're overwriting _every_ frame with
> the LQI data. You'd need to either use the UDP receive interface on
> the intermediate mote or else stick to L2 frames only and do this some
> other way.
>
> Steve
>
> On Wed, Jul 14, 2010 at 1:04 PM, <[email protected]> wrote:
>> Hi,
>> I'm experiencing udp checksum error while forwarding packets in
>> multihop
>> network.
>> I've modified UDPEcho to get RSSI and LQI in a multihop network
>> using getRssi()
>> and getLqi() provide by CC2420Packet interface.
>> I'm testing the application in a basic network:
>> telosb.0 is acting as IPBaseStation
>> telosb.1 is the first hop (directly connected to base station)
>> telosb.2 can reach the base station only hopping through telosb_1
>> when telos.1 receive packet from telosb.2, it read rssi and lqi and
>> write those
>> values in empty fields (nx_uint16) inside the received packet
>> before forward it
>> to the base station. (I'm using blip stack)
>> Wireshark (connected to tun0) shows me udp packets sent from telosb.
>> 2 and its
>> payload is correctly modified by telosb.1 but checksum is incorrect
>> (caused by
>> UDP checksum offload).
>> Moreover, after less than 100 packets sent, network freeze; motes
>> don't send
>> packets anymore.
>> I cannot understand what I'm doing wrong so I post the code below.
>> Could you have a look and give me suggestions?
>>
>> Many thanks
>>
>> Davide
>>
>> ------ CONFIGURATION
>> -----------------------------------------------------------------
>> #include <6lowpan.h>
>> #include "DemoReading.h"
>>
>> configuration AppC {
>>
>> } implementation {
>> components MainC, LedsC;
>> components AppP;
>>
>> AppP.Boot -> MainC;
>> AppP.Leds -> LedsC;
>>
>> components RandomC;
>> AppP.Random -> RandomC;
>>
>> components IPDispatchC;
>> AppP.RadioControl -> IPDispatchC;
>>
>> components new UdpSocketC() as Report;
>>
>> AppP.Report -> Report;
>>
>> components new TimerMilliC() as ReportTimer;
>> AppP.ReportTimer -> ReportTimer;
>>
>> components UdpC;
>>
>> components CC2420Ieee154MessageC;
>> AppP.CC2420Packet -> CC2420Ieee154MessageC.CC2420Packet;
>> AppP.Receive -> CC2420Ieee154MessageC.Ieee154Receive;
>> }
>>
>>
>> --------
>> IMPLEMENTATION
>> ------------------------------------------------------------------------------------------------
>>
>>
>> module AppP {
>> uses {
>> interface Boot;
>> interface SplitControl as RadioControl;
>>
>> interface Leds;
>>
>> interface UDP as Report; // sensor data
>> interface Timer<TMilli> as ReportTimer;
>>
>> interface CC2420Packet;
>> interface Receive;
>> }
>> }
>>
>> implementation {
>>
>> bool timerReportStarted;
>>
>> struct sockaddr_in6 report_dest;
>>
>> nx_struct hreport report;
>>
>> event void Boot.booted() {
>> call RadioControl.start();
>>
>> timerReportStarted = FALSE;
>>
>> report.idrssi = 0x00;
>> report.rssi = 0xFF; //INVALID_SIGNAL_VALUE;
>> report.idlqi = 0x00;
>> report.lqi = 0xFF; //INVALID_SIGNAL_VALUE;
>>
>> report_dest.sin6_port = hton16(APP_PORT);
>> inet_pton6(REPORT_DEST, &report_dest.sin6_addr);
>> call ReportTimer.startPeriodic(1024 * 7);//APP_PERIOD);
>>
>> call Report.bind(7011);//APP_PORT);
>> call Status.bind(7010);//STATS_PORT);
>> }
>>
>> event void RadioControl.startDone(error_t e) {}
>> event void RadioControl.stopDone(error_t e) {}
>>
>>
>> event void Report.recvfrom(struct sockaddr_in6 *from, void *data,
>> uint16_t len, struct ip_metadata *meta) {}
>>
>> event message_t * Receive.receive(message_t *msg, void *payload,
>> uint8_t len){
>>
>> Udp_PaKet *temp_payload = payload;
>>
>> temp_payload->idrssi = 0x2;
>> temp_payload->rssi = call CC2420Packet.getRssi(msg);
>> temp_payload->idlqi = 0x3;
>> temp_payload->lqi = call CC2420Packet.getLqi(msg);
>>
>> }
>> }
>>
>> return msg;
>> }
>>
>>
>> event void ReportTimer.fired(){
>> call Report.sendto(&report_dest, &report, sizeof(report))
>> }
>>
>> }
>>
>>
>>
>> --------
>> DemoReading
>> .h
>> ------------------------------------------------------------------------------------------------
>>
>> /*
>> // SENT UDP PAYLOAD
>> typedef nx_struct hreport{
>> nx_uint8_t idvolt;
>> nx_uint16_t volt;
>> nx_uint8_t idrssi;
>> nx_uint16_t rssi;//nx_uint8_t
>> nx_uint8_t idlqi;
>> nx_uint16_t lqi;//nx_uint8_t
>> }hreport;
>>
>> // PAYLOAD RECEIVED IN CC2420 RECEIVER
>> typedef nx_struct Udp_PaKet{
>> nx_uint32_t part1;
>> nx_uint32_t part2;
>> nx_uint32_t part3;
>> nx_uint16_t part4;
>>
>> nx_uint8_t idrssi;
>> nx_uint16_t rssi;//nx_uint8_t
>> nx_uint8_t idlqi;
>> nx_uint16_t lqi;//nx_uint8_t
>>
>> } Udp_PaKet;
>>
>>
>> */
>>
>
>
>
> --
> stephen dawson-haggerty
> http://cs.berkeley.edu/~stevedh
> uc berkeley wireless and embedded systems lab
> berkeley, ca 94720
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help