Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory usage on Mesh master device. #254

Open
mirhamza708 opened this issue Nov 21, 2024 · 2 comments
Open

Memory usage on Mesh master device. #254

mirhamza708 opened this issue Nov 21, 2024 · 2 comments
Labels

Comments

@mirhamza708
Copy link

I have an stm32F103CB with 128kB fash and 20kB RAM, I am wondering as to how much of this will be used if I run the mesh master application on this and lets say we have 10 slave nodes connected to this master node. Also will this be possible to connect 100 nodes on this master. Will there be any shortage of RAM and flash?

@2bndy5
Copy link
Member

2bndy5 commented Nov 21, 2024

The DHCP list kept on master nodes allocates 3 bytes per network mode (excluding the master node). With memory alignment (which depends on platform), this can actually be 4 bytes per node (which is actually observed on Linux). So, the allocated memory for just the DHCP list is $(n - 1) * a$ where $n$ is the number of nodes in a mesh network (max 255) and $a$ is 3 or 4 bytes depending on the platform's memory alignment.

The DHCP list is allocated dynamically though. Upon RF24Mesh::begin(), the library allocates enough memory for 10 (MESH_MEM_ALLOC_SIZE) nodes. Every time the DHCP list has to grow beyond current capacity, memory for 10 more nodes is additionally allocated.

@2bndy5
Copy link
Member

2bndy5 commented Nov 21, 2024

Will there be any shortage of RAM and flash?

Only if you're using an ATTiny chip.

Tip

You can reduce the memory footprint on non-master nodes by defining the macro symbol MESH_NOMASTER. This is easily done with platformIO's build_flags = -DMESH_NOMASTER, but in Arduino IDE you have to edit this lib's RF24Mesh_config.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants