Hey everyone, I’m struggling with an Arducam Mini 2MP Plus on an STM32H743ZI and hoping someone here has dealt with something similar.
The camera works but it’s really flaky — I’d say it only captures properly maybe half the time. The rest of the time the image is either corrupted or the readout just seems to hang. When it does work, the frame readout speed is way slower than I’d expect.
I’ve been probing around with an oscilloscope comparing the behavior side-by-side with the same camera running on an Arduino. On the Arduino side the signals are clean and consistent. On the STM32 side the timing looks off — there are gaps and irregularities on the SPI lines that don’t appear on the Arduino. I’m starting to think the stock STM32 driver just isn’t handling the data stream efficiently, especially since I’ve got other tasks running on the same MCU.
What I’m really looking for is any example code that uses LDMA (Linked DMA) on the STM32H743 to read out frames. The idea is to offload the SPI-to-memory transfer completely to DMA so the CPU can do other work instead of babysitting the pixel readout. Does Arducam have any reference code for this?
Thanks for the detailed report — and nice work with the scope comparison, that’s really useful context.
Regarding the LDMA source code for STM32: unfortunately we don’t currently have example code specifically demonstrating Linked DMA frame readout on the STM32H743 platform. Our existing STM32 examples use more basic DMA transfer approaches.
Ah that’s a shame. Even if it’s not LDMA-specific, is there any STM32 code at all in your repo that I can use as a baseline? Just something that shows proper initialization and capture on STM32 — I can try to adapt the DMA chain myself if I have a working starting point. I’ve been porting from the Arduino library but clearly something is getting lost in translation.
Absolutely — we do have a dedicated STM32 repository that should give you a solid starting point. You can find it here: GitHub - ArduCAM/STM32 · GitHub
That repo contains our STM32 HAL-based examples covering initialization, register configuration, and single-capture / continuous-capture flows. It’s not using Linked DMA out of the box, but the capture routines will show you the correct sequence for SPI reads and how the FIFO handshake is managed, which should help you spot where your port might be diverging from the expected timing.
Great, I’ll pull that down and take a look. I suspect the issue in my port is around how I’m handling the vsync interrupt and the SPI DMA completion callbacks — on the Arduino version the timing is tighter because it’s doing blocking reads, but with the STM32 async DMA approach I might be introducing race conditions that explain the intermittent corruption I’m seeing on the scope. I’ll compare my init sequence against the repo and report back if I find anything useful.