Peer to peer Application - Page 1
Forum section: electronics / general

author: Peili
author_rank: Regular Contributor
timestamp: September 24, 2019, 05:10:49 am
content: 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.

author: Peili
author_rank: Regular Contributor
timestamp: September 24, 2019, 05:37:05 am
content: 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..

author: ataradov
author_rank: Super Contributor
timestamp: September 24, 2019, 03:45:58 pm
content: 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.

author: Peili
author_rank: Regular Contributor
timestamp: September 25, 2019, 04:27:19 am
content: Quote from: ataradov on September 24, 2019, 03:45:58 pmSorry. This wasflag and not flag1.. Theflag is set to 1 when an interrupt happen..Quote from: ataradov on September 24, 2019, 03:45:58 pmWaking 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.

author: ataradov
author_rank: Super Contributor
timestamp: September 25, 2019, 04:30:09 am
content: 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.

author: Peili
author_rank: Regular Contributor
timestamp: September 25, 2019, 04:48:46 am
content: Quote from: ataradov on September 25, 2019, 04:30:09 amThis is the peer to peer application use HAL_Sleep(). But i'm getting error asundefined reference to `HAL_Sleep'..Quote from: ataradov on September 25, 2019, 04:30:09 amI 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

author: ataradov
author_rank: Super Contributor
timestamp: September 25, 2019, 04:50:54 am
content: 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?

author: Peili
author_rank: Regular Contributor
timestamp: September 25, 2019, 09:03:06 am
content: Thank you Alex.. Code worked perfectly

author: Peili
author_rank: Regular Contributor
timestamp: November 01, 2019, 10:27:00 am
content: Hi,I would like to know the maximumrange that Lwmesh supports in Peer to Peer.Is there any change with WSNDemo? I didn't find anyPHY_SetTxPower()in Peer to Peer Application. So what will be the TX power in the Peer to Peer condition?

author: ataradov
author_rank: Super Contributor
timestamp: November 01, 2019, 04:14:35 pm
content: 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,

author: Peili
author_rank: Regular Contributor
timestamp: November 02, 2019, 05:42:38 am
content: 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?

author: ataradov
author_rank: Super Contributor
timestamp: November 02, 2019, 05:46:29 am
content: 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.