Hi everyone,
(Note: I am not a native English speaker, so I am using AI to help translate this message. I apologize for any unnatural phrasing.)
I am experiencing a persistent issue where run_classifier() returns EI_IMPULSE_OUTPUT_TENSOR_NULL(-33) at the very end of the inference process. I have debugged the issue down to a specific pointer assignment in the SDK, but I need some help resolving it.
Here is the detailed report of my environment and findings:
1. Environment & Prerequisites
- Hardware: PIC32MX270F256B (MIPS architecture)
- Compiler: XC32 (v5.10)
- IDE: MPLAB X IDE (v6.30) / Simulator environment
- SDK Download Date: August 10, 2026 (Very recent build)
- Data Type: Time-series data (Accelerometer)
- Window Size / Stride: 2000ms / 500ms
- Learning Blocks: Classification + Anomaly Detection (K-means)
- Deployment Target: C++ Library
- Inference Engine: EON Compiler
- Estimated Performance: RAM usage 3.0k / FLASH usage 15.8k
2. The Problem
Whenever I execute run_classifier(), it always fails at the end of the inference process, resulting in the output tensor being evaluated as NULL (EI_IMPULSE_OUTPUT_TENSOR_NULL).
3. Attempted Solutions (Unsuccessful)
- Increased the MCU Heap Size to
48000. - Increased
EI_CLASSIFIER_TFLITE_LARGEST_ARENA_SIZEto7000. - Rebuilt the model on the Edge Impulse dashboard, re-downloaded the C++ library, and re-integrated it into the project.
4. Deep-Dive Debugging Results
I used the MPLAB X debugger to step through the code and monitor the variables in the watch window. Here is what I found:
-
Suspected Location: The issue seems to occur in the
run_nn_inference()function insideedge-impulse-sdk\classifier\inferencing_engines\tflite_eon.h. -
Pointer Allocation Succeeds: Inside the
case kTfLiteInt8:block, the memory allocationnew matrix_i8_t(1, output_size)itself is successful. I assigned it to a temporary variable and confirmed that a valid memory address is allocated. -
Assignment Fails / Potential Buffer Overrun: The code attempts to store the result into
result->_raw_outputs[learn_block_index + output_ix].matrix_i8. However, when checking via the debugger, the matrix is NOT properly stored in the array. It behaves as if the pointer assignment fails or gets overwritten.
Given that the memory is successfully allocated but fails to be stored in the _raw_outputs struct array, could this be an architecture-specific issue (e.g., pointer size, struct alignment/padding on the XC32 compiler/MIPS architecture)?
Has anyone encountered a similar issue or has any advice on how to properly assign the allocated matrix to the result struct in this environment?
Any help would be greatly appreciated. Thank you!