Hello, Nick:
It seems your project has very high similarity to the project we are working on. We are trying to use lwmesh for about 50 sensing nodes per gateway (smaller than your scale). I implemented the LWMESH to my nodes and gateway. To start with, I used two nodes, one was setup as a router (add. 0x1006) and one as device (add. 0x8006). Both are close to the gateway ~5 meters away.
#define APP_ADDR 0x1006 // Simulated Coordinator0X00, Routing node <0X8000, here defines the network address for the node.
#define APP_PANID 0x1234
#define APP_SENDING_INTERVAL 4000 // milliseconds
#define APP_ENDPOINT 1 //0 is reserved, 1-15 can be used for the endpoints where data can be accessed from outside of the wsn
#define APP_SECURITY_KEY "TestSecurityKey0" //encryption key, can be changed to your own key
/*Frequency is defined below. Sub-GHZ, 780MHz in China, 868/900MHz in EU require three parameters
2.4GHz only needs one, i.e., app_channel 11-26, 0x0b-0xfa */
#if (defined (PHY_AT86RF212B) || defined (PHY_AT86RF212))
#define APP_CHANNEL 0x01
#define APP_BAND 0x00
#define APP_MODULATION 0x24
#else
#define APP_CHANNEL 0x0f //RF channel 15, can be changed
#endif
#define PHY_ENABLE_RANDOM_NUMBER_GENERATOR
#define SYS_SECURITY_MODE 0
#define NWK_BUFFERS_AMOUNT 16
#define NWK_DUPLICATE_REJECTION_TABLE_SIZE 50
#define NWK_DUPLICATE_REJECTION_TTL 1000
#define NWK_ROUTE_TABLE_SIZE 50
#define NWK_ROUTE_DEFAULT_SCORE 3
#define NWK_ACK_WAIT_TIME 1000 /* ms */
#define NWK_GROUPS_AMOUNT 3
#define NWK_ROUTE_DISCOVERY_TABLE_SIZE 5
#define NWK_ROUTE_DISCOVERY_TIMEOUT 1000 /* ms */
#define APP_RX_BUF_SIZE 20
#define NWK_ENABLE_ROUTING
#define NWK_ENABLE_SECURITY
#define NWK_ENABLE_ROUTE_DISCOVERY
It works great. Very smooth and stable.
Then I try to increase number of the nodes. First I used 5 nodes, two router (0x1005, 0x1001), and three devices (0x8006,0x8007,0x800A). The data sending interval changed to 1min (60,000 ms), i.e..,
#define APP_SENDING_INTERVAL 4000 // milliseconds
Then I found the routers and device continously sending message as usual, but gateway always get stuck in the middle, and looping around
static void phyWaitState(uint8_t state)
{
while (state != (phyReadRegister(TRX_STATUS_REG) & TRX_STATUS_MASK)) {
}
}
I checked the state is = 22,
Do you know what causes the looping? Phy layer is receiving messages, but not passing the message to the app layer appDataInd(), where I send data to the server using lwip udp function.
I read many of Alex's post, but still not able figure out the cause.
Also, would you be able to share some your program once you finalize your project?