mirror of
https://github.com/openmv/openmv.git
synced 2025-09-26 23:09:13 +08:00
ports/stm32: Fix DMA transfer of small buffer sizes.
HAL_DCMI_Start_DMA() only sets up one node in the circular linked-list when the transfer size is < 64KB. This causes a user setting transfer error which locks up the DMA hardware. The fix is to dynamically make the link list linear on smaller sizes and circular on larger sizes.
This commit is contained in:
parent
2e525c504b
commit
feaca6af12
@ -640,6 +640,13 @@ static int stm_csi_snapshot(omv_csi_t *csi, image_t *image, uint32_t flags) {
|
||||
csi->dma_size /= 2;
|
||||
}
|
||||
|
||||
// Disable circular mode for transfer sizes less than 64KB.
|
||||
if (csi->dma_size * 4 <= OMV_CSI_DMA_MAX_SIZE / 4) {
|
||||
HAL_DMAEx_List_ClearCircularMode(&dma_queue);
|
||||
} else {
|
||||
HAL_DMAEx_List_SetCircularMode(&dma_queue);
|
||||
}
|
||||
|
||||
csi->one_shot = true;
|
||||
HAL_DCMI_Start_DMA(&csi->dcmi, DCMI_MODE_SNAPSHOT, (uint32_t) buffer->data, csi->dma_size);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user