Need Help: Combining TinyML Inference with BLE DFU on nRF7002DK – Crashing at Runtime

Hi everyone,

I’m working on a project involving the nRF7002DK, where I’m trying to combine two separately working applications:

  1. A TinyML CIFAR-10 image classification project using TensorFlow Lite Micro
  2. A BLE DFU-capable peripheral application (6153.peripheral_lbs_ble_fota.zip) that allows firmware updates over Bluetooth via the nRF Connect mobile app

I want to Enable on-device ML inference while also supporting Bluetooth firmware/model updates via DFU.

Issue:

Individually, both applications work perfectly. However, once I integrate them, the merged application builds and flashes successfully but crashes at runtime during the model setup phase. The crash is caused by a usage fault related to unaligned memory access, which occurs during MicroInterpreter initialization and tensor_arena usage.

What I’ve Tried:

  • Replaced dynamic memory with a statically allocated tensor_arena using alignas(16)
  • Tried placing tensor_arena in .noinit memory section
  • Increased stack sizes in prj.conf
  • Verified all include paths and CMake configurations
  • Moved TinyML logic to src and called setup() and loop() after BLE initialization
  • Attempted to reduce tensor arena size and print memory layout

Despite all this, the crash persists. BLE functionality remains intact, but the inference setup always causes a Zephyr fatal error and system reset.

Request: If anyone has experience with combining ML inference and BLE DFU on Nordic devices or specifically with the nRF7002DK. I would really appreciate any guidance or working examples. Potential issues I’m considering include:

  • Flash/RAM layout conflicts
  • SPI/QSPI usage overlap
  • Memory section misconfigurations
  • Conflicts with TF-M or secure/non-secure regions

This integration is an important part of my university research project. I’ve included links to both the BLE DFU sample and my TinyML repo:

  • dfu sample: /cfs-file/__key/communityserver-discussions-components-files/4/2021.peripheral_5F00_lbs_5F00_ble_5F00_fota.zip
  • TinyML Project: github.com/.../main

I’ve also attached a screenshot of the crash output in the serial monitor. Any help or suggestions would mean a lot. Happy to share logs or a zipped version of the project if needed.

Thanks in advance!

Related