V
V
veydlin2015-08-26 11:22:00
Adobe After Effects
veydlin, 2015-08-26 11:22:00

DCMI + DMA + OV7670 - how to get data?

I can’t pick up the data, a black screen is displayed on the display
Controller STM32F429
In order not to scare people away, I will post only the main function:

// DCMI
DCMI_HandleTypeDef OV7670_hdcmi_eval;

void DCMI_DMA_init(void){
  GPIO_InitTypeDef GPIO_InitStruct;

  static DMA_HandleTypeDef hdma;
  DCMI_HandleTypeDef *hdcmi = &OV7670_hdcmi_eval;

  // Тактирование
  __DCMI_CLK_ENABLE();
  __DMA2_CLK_ENABLE();
  __GPIOE_CLK_ENABLE();
  __GPIOA_CLK_ENABLE();
  __GPIOC_CLK_ENABLE();
  __GPIOD_CLK_ENABLE();
  __DCMI_CLK_ENABLE();
  __DMA2_CLK_ENABLE();


  // Настройка DCMI портов (вырезано для экономии места)

  // DCMI
  hdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
  hdcmi->Init.CaptureRate = DCMI_CR_ALL_FRAME;
  hdcmi->Init.HSPolarity = DCMI_HSPOLARITY_LOW;
  hdcmi->Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
  hdcmi->Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
  hdcmi->Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
  hdcmi->Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
  hdcmi->Init.JPEGMode = DCMI_JPEG_DISABLE;
  hdcmi->Instance = DCMI;


  // DMA
  hdma.Init.Direction = DMA_PERIPH_TO_MEMORY;
  hdma.Init.PeriphInc = DMA_PINC_DISABLE;
  hdma.Init.MemInc = DMA_MINC_ENABLE;
  hdma.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
  hdma.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
  hdma.Init.Mode = DMA_NORMAL;
  hdma.Init.Priority = DMA_PRIORITY_HIGH;
  hdma.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
  hdma.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
  hdma.Init.MemBurst = DMA_MBURST_SINGLE;
  hdma.Init.PeriphBurst = DMA_PBURST_SINGLE;
  hdma.Instance = DMA2_Stream1;


  // Связываем DMA с DCMI
  __HAL_LINKDMA(hdcmi, DMA_Handle, hdma);

  // Прерывание по завершении передачи
  HAL_NVIC_SetPriority(DCMI_IRQn, 5, 0);
  HAL_NVIC_EnableIRQ(DCMI_IRQn);

  // Прерывание при полном приеме
  HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 5, 0);
  HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);

  // Инициализация DMA с DCMI
  HAL_DCMI_Init(hdcmi);
  HAL_DMA_Init(hdcmi->DMA_Handle);

  // Включение DMA с DCMI
  __HAL_DCMI_ENABLE(&OV7670_hdcmi_eval);
  __HAL_DMA_ENABLE(OV7670_hdcmi_eval.DMA_Handle);
}

Data is retrieved by this function
// Обновить буфер
void OV7670_update(void){
  HAL_DCMI_Start_DMA(&OV7670_hdcmi_eval, DCMI_MODE_SNAPSHOT, (uint32_t)&OV7670_buffer, IMG_ROWS * IMG_COLUMNS * 2 / 4);
}

The DCMI_IRQHandler interrupt is invoked. After each call to OV7670_update(), DMA2_Stream1_IRQHandler fires

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmytro Korolkov, 2019-03-05
@d-korolkov

Pointer movement step - 1 frame (PageDown key).
The scale of units of measurement (frames-time) can be switched by clicking LMB with Ctrl held down here: 5c7e794cd02e4176256454.png
And what would be absolutely the essence of the matter is: millisecond = 1/1000 second, if you make a project in which you specify a frame rate of 1000 per second, then the step of the pointer will be exactly 1ms.
On the other hand, the maximum frame rate in AE is 99fps, so the minimum step can be set to 1/99 of a second :)

V
veydlin, 2015-09-04
@veydlin

You need to update the HAL version

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question