Author Topic: LWmesh Sending data in Two times  (Read 1173 times)

0 Members and 1 Guest are viewing this topic.

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
LWmesh Sending data in Two times
« on: January 04, 2018, 05:46:03 am »
Hi
     I have modified Lwmesh Atmel's stack of WSNDemo application to send data two times as follows {one example}
Code: [Select]
appMsg1.parentShortAddr=NWK_RouteNextHop(0,0);
appNwkDataReq.dstAddr=0x0000;
appNwkDataReq.dstEndpoint=APP_ENDPOINT;
appNwkDataReq.srcEndPoint=APP_ENDPOINT;
appNwkDataReq.options=NWK_OPT_ENABLE_SECURITY;
appNwkDataReq.data=(uint8_t*)&appMsg;
appNwkDataReq.size=sizeof(appMsg1);
appNwkDataReq.confirm=appDataConf;
NWK_DataReq(&appNwkDataReq);

/*********Send Second packet**********/

appMsg2.parentShortAddr=NWK_RouteNextHop(0,0);
appNwkDataReq1.dstAddr=0x0000;
appNwkDataReq1.dstEndpoint=APP_ENDPOINT;
appNwkDataReq1.srcEndPoint=APP_ENDPOINT;
appNwkDataReq1.options=NWK_OPT_ENABLE_SECURITY;
appNwkDataReq1.data=(uint8_t*)&appMsg;
appNwkDataReq1.size=sizeof(appMsg2);
appNwkDataReq1.confirm=appDataConf;
NWK_DataReq(&appNwkDataReq1);

Here am getting the same parent address in both packets. I expect to have 0xFFFF in the first packet and 0x0000(or some other address) in the second packet.I tried the same scenario for 5 packets.In all the five packet am getting the same result of five times same parent.Do I reset anything after sending one packet?please help
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: LWmesh Sending data in Two times
« Reply #1 on: January 04, 2018, 06:17:14 am »
You are sending "appMsg" in both cases, not "appMsg1" and "appMsg2". Copy-paste error.

And also, why do you expect different values, when you fill the payload with the same value?

NWK_RouteNextHop() will return a different value only after appDataConf() is called for the first transfer and routing tables actually updated.

NWK_DataReq() is not sending anything, it just puts a message into a queue and exits. The actual sending happens much later in NWK_TaskHandler() and all dependent functions.
« Last Edit: January 04, 2018, 06:24:22 am by ataradov »
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: LWmesh Sending data in Two times
« Reply #2 on: January 04, 2018, 06:53:35 am »
You are sending "appMsg" in both cases, not "appMsg1" and "appMsg2". Copy-paste error.
Sendind appMsg1 and appMsg2. Error in posted question not in code.Sorry
Quote
And also, why do you expect different values, when you fill the payload with the same value?
I want to monitor the change of parent address while sending the packet .
Quote
NWK_RouteNextHop() will return a different value only after appDataConf() is called for the first transfer and routing tables actually updated.
I think am calling appDataConf after sending each packet.is .or else how can I send data with updated parent address value in this flow .
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: LWmesh Sending data in Two times
« Reply #3 on: January 04, 2018, 06:59:27 am »
I want to monitor the change of parent address while sending the packet .
But in this code you are not sending the packets, you just lining them up to be sent much later. After encryption, route discovery, retries, etc.

I think am calling appDataConf after sending each packet.is .
Stack must call it. You calling it does absolutely noting.

You are missing the point of cooperative multitasking. This task just lets other.

Look at the code and see that NWK_DataReq() does not talk to the radio in any way.

or else how can I send data with updated parent address value in this flow .
You send one and exit while waiting for appDataConf() to be called. Then you fill the next request right in appDataConf() or use it to schedule a task (change of application state) that actually sends a message.

You will have to work with stack machines, just like sample applications do.
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: LWmesh Sending data in Two times
« Reply #4 on: January 04, 2018, 07:09:08 am »
Quote
You send one and exit while waiting for appDataConf() to be called. Then you fill the next request right in appDataConf() or use it to schedule a task (change of application state) that actually sends a message.
Is the flow is same as real WSNDemo?c code.Here it handles application state change
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: LWmesh Sending data in Two times
« Reply #5 on: January 04, 2018, 07:10:10 am »
I don't understand the question. Can you post full source code?
Alex
 

Offline vishalTopic starter

  • Regular Contributor
  • *
  • Posts: 102
  • Country: in
Re: LWmesh Sending data in Two times
« Reply #6 on: January 05, 2018, 03:00:21 am »
Is the flow is same as in original WSNDemo.c code in the lwmesh stack.In this application it handles APP state change
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11259
  • Country: us
    • Personal site
Re: LWmesh Sending data in Two times
« Reply #7 on: January 05, 2018, 03:02:19 am »
I still don't understand. Post more complete code, otherwise I can't help you.
Alex
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf