Hi Andrew,
The MEM_WriteReadTest() should not be used! It was created to test the memory pools after MEM_Init()!
If you use this function and an error code is returned, then some or all memory buffers will remain allocated!
The PhyPlmeTimmedRxRequest() function is called before an Rx sequence needs to be programmed, and will allocate memory for the packet to be received. Once a packet is received, this buffer is sent to the MAC layer which is responsible for freeing the memory.
If no packet was received at the last Rx sequence, the memory will remain allocated, and the next time the PhyPlmeTimmedRxRequest() function is called, the memory block will be reused.
If there are more than 1 memory buffers allocated by PhyPlmeTimmedRxRequest() after a Scan, then the issue is at the MAC/PHY layers.
Also, it may be possible that the default configuration from MemManagerConfig.h is not enough for your scenario.
You can try to increase the number of blocks in each memory pool and check if the problem persists.
Regards,
George