Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Blog

DheerajPK_41
Moderator
Moderator

How to monitor free RAM and buffer usage in BTSDK applications

Embedded devices are generally memory constraint devices. When writing an application we should extremely careful in optimising the memory consumption. So, while building an application, it is important to monitor the available free memory in the device which we can use it for further feature development.

Let me introduce two useful APIs available in BTSDK platforms to monitor the memory usage.

 

1. wiced_memory_get_free_bytes

Use wiced_memory_get_free_bytes() to get the number of free bytes of RAM left in your application. Please check wiced_memory.h for its documentation. Example usage and output are shown below.

Usage

Capture9.JPG

Output

Capture10.JPG

 

2. wiced_bt_get_buffer_usage

There are four buffer pools  available in BTSDK platforms and they are allocated by the stack using the configuration defined in wiced_bt_cfg_buf_pool_t. Use wiced_memory_get_free_bytes() to get dynamic buffer usage from the last start of the system.  Please check wiced_memory.h for it's documentation. Example usage and output are shown below.

Usage

Capture3.JPG

Capture4.JPG

Output

Capture2.JPG

 

FYI.

Sample code is attached. Please check it.

To know more about buffer pool, please go through WICED-Application-Buffer-Pools.pdf

0 Likes
Top labels