Skip to main content
victory015
Associate
August 11, 2016
Question

camera project without dma to LCD

  • August 11, 2016
  • 15 replies
  • 2617 views
Posted on August 12, 2016 at 01:40

dear all,

I have studied the camera sample project, it uses dma from camera address to LCD memory address. I do not have lcd in my design, so when i run the camera project, i see one whole black image. 

Is there a way to modify the project so that it uses dma to SD Card address directly? 

thanks,

victor

#camera
    This topic has been closed for replies.

    15 replies

    Tesla DeLorean
    Guru
    August 15, 2016
    Posted on August 15, 2016 at 15:04

    Transferring one byte hardly seems like a viable configuration. It needs to describe the transfer buffer in units of the transfer width. These would probably need to be word or half-word, depending on what you have interfaced to the DCMI port.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    victory015
    Associate
    August 16, 2016
    Posted on August 16, 2016 at 03:46

    The HT and TC interrupts, where do i manage them ? in stm32f4xx_it.c ?

    The stm32f4 camera example has the irq handler as below. Do i create a similar irq handler for DCMI? 

    void SD_SDIO_DMA_IRQHANDLER(void)

    {

      /* Process DMA2 Stream3 or DMA2 Stream6 Interrupt Sources */

      SD_ProcessDMAIRQ();

    }

    victory015
    Associate
    August 16, 2016
    Posted on August 16, 2016 at 03:57

    i may find the code for DCMI TC interrupt. i add the code below to stm32f4 camera example. But the interrupt handler (DMA2_Stream1_IRQHandler) is never called when the blue button is pressed. Please help me !!

    DMA_ITConfig(DMA2_Stream1, DMA_IT_TC, ENABLE);

    void DMA2_Stream1_IRQHandler(void)

    {

       DMA_ClearITPendingBit(DMA2_Stream1, DMA_IT_TC);

       DMA_Cmd(DMA2_Stream1, DISABLE);

       DMA_Cmd(DMA2_Stream1, ENABLE);

    }

    Tesla DeLorean
    Guru
    August 16, 2016
    Posted on August 16, 2016 at 04:41

    Presuming you picked the right DMA, channel and stream...

    ...
    NVIC_Configuration();
    ...
    /* Enable DMA Stream Half / Transfer Complete interrupt */
    DMA_ITConfig(DMA2_Stream1, DMA_IT_TC | DMA_IT_HT, ENABLE);
    ...
    //******************************************************************************
    void NVIC_Configuration(void)
    {
    NVIC_InitTypeDef NVIC_InitStructure;
    /* Enable the DMA Stream IRQ Channel */
    NVIC_InitStructure.NVIC_IRQChannel = DMA2_Stream1_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);
    }
    //******************************************************************************
    void DMA2_Stream1_IRQHandler(void)
    {
    /* Test on DMA Stream Half Transfer interrupt */
    if (DMA_GetITStatus(DMA2_Stream1, DMA_IT_HTIF1))
    {
    /* Clear DMA Stream Half Transfer interrupt pending bit */
    DMA_ClearITPendingBit(DMA2_Stream1, DMA_IT_HTIF1);
    // Add code here to process first half of buffer (ping)
    }
    /* Test on DMA Stream Transfer Complete interrupt */
    if (DMA_GetITStatus(DMA2_Stream1, DMA_IT_TCIF1))
    {
    /* Clear DMA Stream Transfer Complete interrupt pending bit */
    DMA_ClearITPendingBit(DMA2_Stream1, DMA_IT_TCIF1);
    // Add code here to process second half of buffer (pong)
    }
    }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    victory015
    Associate
    August 16, 2016
    Posted on August 16, 2016 at 16:53

    Thank you for the useful code snippet. Now the interrupt handler

    DMA2_Stream1_IRQHandler

    gets called after adding

    NVIC_Configuration();

    I put a breakpoint in

    DMA2_Stream1_IRQHandler

    . After DMA_Cmd(DMA2_Stream1, ENABLE); the breakpoint keeps getting triggered, which means the DMA_IT_TC interrupt is generated all the time (i only add DMA_IT_TC in DMA_ITConfig). This does not make sense as the camera blue button is not pressed.i have not figured out why.