2021-05-02 10:06 AM
I have been working for about 4 weeks on a project which has the STM32L4R5AIIx processor
and is using the camera MT9M114 from ON Semiconductor.
The project uses the following command to take a snap shot.
"HYPERRAM_BASE_ADDRESS" is the starting address of the HYPER-RAM memory.
HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)HYPERRAM_BASE_ADDRESS, DATA_SIZE_WORDS)
When I looked on the scope (I checked the Line Valid line and the Frame Valid line),
I could see that data was coming out of the camera chip.
But in the DCMI Frame Event callback, there was no data in the Hyper-RAM memory.
I know that the Hyper-RAM memory is woeking because I already verified it.
I checked further and found that even though data was coming out of the camera chip,
the DMA never received a request that there was data in the DCMI buffer.
I did this by checking the value of the DMA register "DMA_CNDTRx" in the
DCMI Frame Event callback. The value of this register was not incremented to "0"
Does anyone know why the DMA does not receive a request that there was data in the DCMI buffer?
At the startup of the project I was able to configure the camera successfully through I2C.
Here is the initialization of the DCMI:
// Initialize the DCMI interface
hdcmi.Instance = DCMI;
hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_HIGH;
hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;
hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;
hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;
hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;
hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;
hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;
// Initialize the DMA Channel
hdma_dcmi.Instance = DMA1_Channel1;
hdma_dcmi.Init.Request = DMA_REQUEST_DCMI;
hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;
hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
hdma_dcmi.Init.Mode = DMA_NORMAL;
hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(hdcmi,DMA_Handle,hdma_dcmi);
HAL_NVIC_SetPriority(DCMI_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DCMI_IRQn);
/* DMA1_Channel1_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
/* DMAMUX1_OVR_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMAMUX1_OVR_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMAMUX1_OVR_IRQn);