Author Topic: Peer to peer Application  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Peer to peer Application
« on: September 24, 2019, 05:10:49 am »
Hi, I'm using the peer to peer application from LWmesh1_2_1. Successfully coded the 2 devices as 0 and 1 .. also send data through UART. Now i have to modify my application to send data in every 2 sec using a Watch dog timer.. My scenario is to send data and goes to sleep and when watchdog timer wakes up the device it will send data and then goes to sleep.. . I changed my code to send data in every 2sec. But, when I'm using sleep function i cannot wake-up from sleep.. Here I'm attaching my code for the device with app_addr 1.
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #1 on: September 24, 2019, 05:37:05 am »
I understand the basic functionality of Peer to peer is sending data when something is received in the device UART.. Now i change the flow as a data buffer is sending every 2 sec.. Can i use the application in such a way? If i'm wrong please correct me..
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12516
  • Country: us
    • Personal site
Re: Peer to peer Application
« Reply #2 on: September 24, 2019, 03:45:58 pm »
1. This code never sets flag1 to 1.
2. You can't just call NWK_DataReq() and not wait for the confirmation. You also need to call NWK_SleepReq() to actually put transceiver to sleep.

You need to approach things in steps. First of all forget about LwMesh and debug waking up every 2 seconds. Once this is working, combine it with the LwMesh code. But no matter what you have to wait for the stack to be ready to sleep.
« Last Edit: September 24, 2019, 04:39:04 pm by ataradov »
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #3 on: September 25, 2019, 04:27:19 am »
1. This code never sets flag1 to 1.
Sorry. This was flag and not flag1.. The flag is set to 1 when an interrupt happen..
You need to approach things in steps. First of all forget about LwMesh and debug waking up every 2 seconds. Once this is working, combine it with the LwMesh code. But no matter what you have to wait for the stack to be ready to sleep.
Waking up every 2 sec is working fine without Sleep function.. Can i use  HAL_Sleep() in Peer to Peer application.. When i try to use  HAL_Sleep() function i got errors.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12516
  • Country: us
    • Personal site
Re: Peer to peer Application
« Reply #4 on: September 25, 2019, 04:30:09 am »
Well, now make sure that MCU sleep works with 2 second interval.

Why do you want to use WDT anyway when normal sleep function already sleeps for a set amount of time?

What errors? Peer2Peer is just an application, of course you can use sleep with that. You just need to make sure to place it correctly and make sure that stack is ready for sleep.
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #5 on: September 25, 2019, 04:48:46 am »
What errors? Peer2Peer is just an application, of course you can use sleep with that. You just need to make sure to place it correctly and make sure that stack is ready for sleep.

This is the peer to peer application use HAL_Sleep(). But i'm getting error as undefined reference to `HAL_Sleep'..

Why do you want to use WDT anyway when normal sleep function already sleeps for a set amount of time?

I want to send data in every 2sec and then the device should sleep.. when an interrupt hit then wake up and send. That's my scenario
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12516
  • Country: us
    • Personal site
Re: Peer to peer Application
« Reply #6 on: September 25, 2019, 04:50:54 am »
Well, you are not including the halSleep.c or whatever it is called in your project by the looks of it, you need to add that file.

Well, normal HAL_Sleep(2000) will sleep for 2 seconds, then wake up and send the data, then go back to sleep. This is EXACTLY what WSNDemo does. Why not start with that application?
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #7 on: September 25, 2019, 09:03:06 am »
Thank you Alex.. Code worked perfectly :D
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #8 on: November 01, 2019, 10:27:00 am »
Hi,
  I would like to know the maximum range that Lwmesh supports  in Peer to Peer. Is there any change with WSNDemo? I didn't find any  PHY_SetTxPower() in Peer to Peer Application. So what will be the TX power in the Peer to Peer condition?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12516
  • Country: us
    • Personal site
Re: Peer to peer Application
« Reply #9 on: November 01, 2019, 04:14:35 pm »
The range is defined by the radio and your hardware design, not the application. PHY_SetTxPower() is a public API, you can add it into any application. It all defaults to the maximum transmit power anyway,
Alex
 

Offline PeiliTopic starter

  • Regular Contributor
  • *
  • Posts: 108
  • Country: in
Re: Peer to peer Application
« Reply #10 on: November 02, 2019, 05:42:38 am »
PHY_SetTxPower() is added to my Peer to Peer application. And also i set a power of 0x00(Max tx power) .. Then i chnged it to 0x09.. But i can't distinguish the distance difference in these TXPowers. Also i set 0x0F(Min power) it shows less range.. I think the ranges between 0x00 and 0x0F have no meaning in my application. What will be the reason for this?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 12516
  • Country: us
    • Personal site
Re: Peer to peer Application
« Reply #11 on: November 02, 2019, 05:46:29 am »
Because it is hard to correlate TX power and range. You would have to actually use the spectrum analyzer to see the difference. The "range" is not a thing in packet radio communication. Probability of loss/delivery is a real measure. For that you need to send a lot of frames and measure how many were lost. Do this for  all settings and you will see the difference.
Alex
 
The following users thanked this post: Peili


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->