STM32N6 - Reasons for differences in release and debug mode?
Hi, I hope everyone is doing well.
I have an application on an STM32N6 that is running a VENC JPEG encoding (each 2nd frame, snapshot) and a neural network inference (every frame, continuous). These happen on two different DCMIPP pipes.
Additionally, I have two modes of compiling my application:
- Debug `-g3 -O0`
- Release `-O2` (no debug)
No other flags change, because I just manually edit them, I don’t use profiles or similar modernities.
In debug mode I see the application working properly as expected (almost; there are times it hangs, just like the next scenario). When it runs in release mode, the VENC JPEG encoder “randomly” picks a frame here and there to encode, so it’s very very choppy (seconds between a frame; the library returns the code: `H264ENC_HW_BUS_ERROR = -9`). I do see the NPU working as expected (according to my internal counters).
Some noteworthy things, since I don’t know if those matter:
- AXISRAM2: Model weights are loaded into here
- AXISRAM3: NPU input (pipe A) + jpeg output
- AXISRAM4: activations + jpeg input (pipe B)
- AXISRAM5: activations
When receiving a frame (`HAL_DCMIPP_PIPE_FrameEventCallback`) corresponding flags get set so that everything is processed sequentially in `main()`.
Next I tried disabling the NPU code and only have the VENC JPEG working: It never encodes a frame and always returns that same error as above. It only works (and reliably at that) if I set a breakpoint somewhere in main before encoding the frame, hitting that, and continuing every time.
I would like for the VENC JPEG encoder to encode always, and not failing seconds between frames. Does anyone know what the cause for such behavior could be on an STM32N6? Is it cache issues, RIF or RISAF issues, anything else I don’t know? What other infos should I provide so that this problem can be narrowed down further...
Thanks in advance for any tips + best regards, R
