Skip to main content
Associate III
July 3, 2026
Solved

STM32N6 Unable to run VENC parallel to DCMIPP

  • July 3, 2026
  • 2 replies
  • 32 views

Hi all,

 

I merged the VENC_JPEG_Encoding example with a DCMIPP app. Both parts work on their own, but the JPEG encoding breaks (error -9 = JPEGENC_HW_BUS_ERROR) as soon as I turn on the DCMIPP capture. The JPEG input/output buffer is completely unrelated to the DCMIPP buffer. It’s just that as soon as I start the DCMIPP in CONTINUOUS mode, the JPEG encoder breaks… Very strange.

Did anyone else experience this problem? What could cause this? How would I fix this?

 

Best regards, rphii

Best answer by rphii

Very long story very short, it works with this setup:

  • PIPE1 → buffer → VENC JPEG
  • pPipeConfig.FrameRate = DCMIPP_FRAME_RATE_1_OVER_2;

I was a fool for thinking this would work:

  • PIPE1 → buffer a/b → DMA2D → jpeg input → VENC JPEG
  • pPipeConfig.FrameRate = DCMIPP_FRAME_RATE_ALL;

By the way, you can still run PIPE2 capturing every frame. And since it shares its demosaic unit somewhat with PIPE1, this is still perfectly doable:


HAL_DCMIPP_CSI_PIPE_DoubleBufferStart(&hdcmipp, DCMIPP_PIPE2, DCMIPP_VIRTUAL_CHANNEL0, buffer_a, buffer_b, DCMIPP_MODE_CONTINUOUS);
HAL_DCMIPP_CSI_PIPE_Start(&hdcmipp, DCMIPP_PIPE1, DCMIPP_VIRTUAL_CHANNEL0, jpeg_input, DCMIPP_MODE_CONTINUOUS);

 

2 replies

rphiiAuthor
Associate III
July 8, 2026

Update: (no solution yet)

Looking at the example here https://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/STM32N6570-DK/Applications/VENC/VENC_SDCard uses the H264 encoder parallel to the CSI, they use the `BSP_CAMERA_DoubleBufferStart` and `BSP_CAMERA_FrameEventCallback`. I am assuming that they are functionally the same as `HAL_DCMIPP_PIPE_FrameEventCallback` and `HAL_DCMIPP_CSI_PIPE_DoubleBufferStart` respectively. My code now has basically the same “data flow”, without using the BSP but rather the HAL things.

As I see it, there is one example where they show how to use the VENC to encode JPEG static images (not parallel to the DCMIPP CSI), which is the VENC_JPEG_Encoding as stated above… I can’t find another example, right?

One thing that I saw - which I don’t know if it makes a difference or not - is that they enabled the region which they want to encode as noncacheable via. the MPU. I now added this to my code as well, applying the attributes to my three buffers (jpeg output, dcmipp buffer 1 + 2), to no avail.

I am getting images, the DCMIPP CSI interface is working. But I still can’t run the JPEG VENC to encode images parallel to it, still getting the HW bus error.

rphiiAuthorBest answer
Associate III
July 9, 2026

Very long story very short, it works with this setup:

  • PIPE1 → buffer → VENC JPEG
  • pPipeConfig.FrameRate = DCMIPP_FRAME_RATE_1_OVER_2;

I was a fool for thinking this would work:

  • PIPE1 → buffer a/b → DMA2D → jpeg input → VENC JPEG
  • pPipeConfig.FrameRate = DCMIPP_FRAME_RATE_ALL;

By the way, you can still run PIPE2 capturing every frame. And since it shares its demosaic unit somewhat with PIPE1, this is still perfectly doable:


HAL_DCMIPP_CSI_PIPE_DoubleBufferStart(&hdcmipp, DCMIPP_PIPE2, DCMIPP_VIRTUAL_CHANNEL0, buffer_a, buffer_b, DCMIPP_MODE_CONTINUOUS);
HAL_DCMIPP_CSI_PIPE_Start(&hdcmipp, DCMIPP_PIPE1, DCMIPP_VIRTUAL_CHANNEL0, jpeg_input, DCMIPP_MODE_CONTINUOUS);