Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Design of UDP/IP & 6LoWPAN over BLE with respect to memory management.

Hello,

We're using the UDP/IP/6LoWPAN layers as provided by the nRF5 SDK 15.0.0.0.

After experiencing sporadic issues in communication we have a question regarding the design.

When looking at all references of nrf_mem_reserve() in components/iot/ble_6lowpan & components/iot/ipv6_stack it seems that both the receive and transmit path use this function.

  1. The receive path uses it in the ipsp_evt_handler, which to my understanding runs in interrupt context (callback from SoftDevice via observer).
  2. The transmit path uses it when performing a iot_pbuffer_allocate(), in main context.
  3. To my understanding nrf_mem_reserve() is not a reentrant function, which results in race conditions in the memory manager.

Are my finding correct? If so, how is this design to be used without race conditions?

Best regards,

Mathias