KW45 Basic GAP Peripheral Example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

KW45 Basic GAP Peripheral Example

140 次查看
ArushThomas
Contributor III

Hi all,

I'm working with the KW45B41Z-EVK and SDK version 25.06.00 (890 2025-06-27). My goal is to implement a basic GAP Peripheral device over BLE. I need to implement custom GATT Services which can be written to by a phone.

I require a very lightweight baremetal software solution. Having gone through the SDK Examples as well as the Application Code Hub, I'm noticing that the provided examples are all quite complex and convoluted.

I'd like to request a simple example project with the following:

  1. Demonstrates GAP Peripheral functionality, with advertising and connection
  2. Takes the GATT Server role, and clearly exposes attributes and values
  3. Does not utilize dynamic memory allocation (I believe that's what the MEM_BufferAllocWithId() function does)

I'll be driving graphics on the same MCU, which is why I require a lightweight solution - I am hoping for ~15-17KB RAM utilization. I sincerely hope this is possible.

Thanks,

Arush 

标记 (2)
0 项奖励
回复
3 回复数

93 次查看
sofiaurueta
NXP Employee
NXP Employee

Hello,

Hope you are doing well.

 

I understand you would like to implement a GAP peripheral with GATT server role application. You may find it helpful to review the Bluetooth Low Energy Demo Applications Users Guide which includes several wireless examples which demonstrate services using the GATT Server role and GAP Peripheral node, these can serve as a foundation for building an application tailored to your specific requirements.

 

You can also find more information on the Bluetooth Low Energy Application Developer’s Guide, which provide helpful information for developing custom applications, mainly the following sections:

 

Best Regards,
Ana Sofia.

0 项奖励
回复

72 次查看
ArushThomas
Contributor III

Hi,

I have a few problems with the provided examples:

  1. None of the examples are compatible with the 'Peripherals' tool. This makes it difficult to configure and implement other peripherals.
  2. The BLE examples are quite heavily bloated, allocating 25+KB of RAM as static/global variables.
  3. The examples also use an indeterminate amount of RAM through dynamic memory allocation, as well as an indeterminate amount of local variables in the lib_ble_host_cm33_gcc.a and lib_crypto_m33.a files.
  4. The source/ directory is cluttered with numerous SDK files, unrelated to the example's application logic.
  5. The OSA layer is unnecessarily bloated for a baremetal superloop scheduler.

Overall, these issues cause challenges in:

  1. Implementing non-BLE features
  2. profiling and optimizing RAM utilization
  3. identifying and pruning bloat

I request simpler debloated examples - or guidelines - to overcome these specific challenges.

Thanks,
Arush

0 项奖励
回复

37 次查看
sofiaurueta
NXP Employee
NXP Employee

Hello,

 

Due to the complexity of our BLE stack, the provided examples are intended to showcase its full capabilities. For best results and to ensure proper functionality, we strongly recommend using one of the SDK examples as a foundation for your project.

 

If the functionality provided by the SDK examples is not suited for the needs of the application you're developing, you would need to develop a custom implementation, but this is really not recommended or encouraged, as for custom implementations, support is limited.

 

I apologize for the inconveniences this might cause you and your project.

 

Something helpful to reduce and optimize RAM size, consider setting the compiler optimization level to -Os, which often reduces RAM and flash usage. You can adjust this setting in MCUXpresso by navigating Project Properties > C/C++ Build > Settings > Tool Settings

 

Most of the compiler optimization flags for size are already enabled by using the -Os option.

 

Also to reduce the code size, I suggest you choose NewlibNano as library type when creating a new project. NewlibNano is specifically optimized for minimal footprint.

 

Please note that we do not recommend the usage of ConfigTools with the Wireless examples, as it could overwrite previous configurations needed for the wireless part.

 

Best Regards,

Ana Sofia.

0 项奖励
回复