AnsweredAssumed Answered

[HELP] STM32F407 +OV9655(DCMI)+ DMA +UART -> PC

Question asked by kim.manjae on Mar 8, 2016
Hello guys.
I haven't yet solved this problem.
When I send a frame data to the pc by using uart, There is nothing...
I always got 0 0 0 0 0 0 0 0 0 0 values
Could you get me a idea ? Please share with me.
I attached some part of code what I used
                                                           
           
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
           
           
 
*********DCMI*****************
 uint8_t volatile outputbuffer[160*120*2];
  /* DCMI configuration *******************************************************/ 
  DCMI_InitStructure.DCMI_CaptureMode = DCMI_CaptureMode_Continuous;
  DCMI_InitStructure.DCMI_SynchroMode = DCMI_SynchroMode_Hardware;
  DCMI_InitStructure.DCMI_PCKPolarity = DCMI_PCKPolarity_Falling;
  DCMI_InitStructure.DCMI_VSPolarity = DCMI_VSPolarity_High;
  DCMI_InitStructure.DCMI_HSPolarity = DCMI_HSPolarity_High;
  DCMI_InitStructure.DCMI_CaptureRate = DCMI_CaptureRate_1of4_Frame;
  DCMI_InitStructure.DCMI_ExtendedDataMode = DCMI_ExtendedDataMode_8b;
  
  DCMI_Init(&DCMI_InitStructure);
  /* DCMI Interrupts config ***************************************************/
  DCMI_ITConfig(DCMI_IT_VSYNC, ENABLE);
 // DCMI_ITConfig(DCMI_IT_LINE, ENABLE);
 // DCMI_ITConfig(DCMI_IT_FRAME, ENABLE);
 // DCMI_ITConfig(DCMI_IT_ERR, ENABLE);
      
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  NVIC_InitStructure.NVIC_IRQChannel = DCMI_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;  
  NVIC_Init(&NVIC_InitStructure);
  /* Configures the DMA2 to transfer Data from DCMI to the LCD ****************/
  /* Enable DMA2 clock */
  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);  
  
  /* DMA2 Stream1 Configuration */  
  DMA_DeInit(DMA2_Stream1);
  DMA_InitStructure.DMA_Channel = DMA_Channel_1;  
  //DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;    
  DMA_InitStructure.DMA_PeripheralBaseAddr =(uint32_t)(DCMI_BASE+ 0x28);    
  //DMA_InitStructure.DMA_Memory0BaseAddr =FSMC_LCD_ADDRESS;
    DMA_InitStructure.DMA_Memory0BaseAddr =(uint32_t)outputbuffer;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
  DMA_InitStructure.DMA_BufferSize = 0xffff;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;         
  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
     
  DMA_Init(DMA2_Stream1, &DMA_InitStructure); 
       
}
**************************MAIN_PART**************************************************
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
#include "usart.h"
#include "LCD/LCD.h"
#include "camera/dcmi_OV9655.h"
/** @addtogroup STM32F2xx_StdPeriph_Examples
  * @{
  */
/** @addtogroup IOToggle
  * @{
  */ 
/**
  * @brief  Main program
  * @param  None
  * @retval None
  */
void SendPicture(uint8_t * array);
extern  uint8_t volatile outputbuffer[160*120*2];
int main(void)
{    
    OV9655_IDTypeDef OV9655ID;
    USART_Configuration();
    USART_NVIC_Config();
    //LCD_Initializtion();
  //LCD_Clear(Red);
    //GUI_Text(100,104,"Camera Init..",White,Blue);
    printf("\r\n\r\nWelcome to WaveShare STM32F4 series MCU Board Open207V-D\r\n");
    printf("OV9655 Init..\r\n");
    if(DCMI_OV9655Config()==0){
        printf("Camera Have Init..\r\n");
        //GUI_Text(50,90,"Camera Have Init..",White,Red);
        }
    else {
        printf("OV9655 Init fails!!\r\n");
        //GUI_Text(50,90,"OV9655 Init fails!!",White,Red);
        }
        
    DCMI_OV9655_ReadID(&OV9655ID);
    printf("OV9655 ID:0x%x 0x%x 0x%x 0x%x\r\n",OV9655ID.Manufacturer_ID1, OV9655ID.Manufacturer_ID2, OV9655ID.PID, OV9655ID.Version);
    
            
    //    LCD_WriteReg(0x0011,0x6068);
    //    LCD_SetPoint(100,100,100);
    //LCD_REG = 0x0022;
    /* Start Image capture and Display on the LCD *****************************/
    /* Enable DMA transfer */
    DMA_Cmd(DMA2_Stream1, ENABLE);
    /* Enable DCMI interface */
    DCMI_Cmd(ENABLE); 
    
    
    /* Start Image capture */ 
    DCMI_CaptureCmd(ENABLE);
        SendPicture(outputbuffer);
    //    SendPicture();
    //DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x8d, 0x10); //color test    on
    //DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x0c, 0x80); //color test    on
    //uint32_t i=0x1fffff;
//    while(i--);
    //DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x8d, 0x00); //color test off
    //DCMI_SingleRandomWrite(OV9655_DEVICE_WRITE_ADDRESS,0x0c, 0x00); //color test off                    
    while (1)
    {
    }
}
void SendPicture(uint8_t * array)
{
    uint16_t K;
    for(K=0; K < 38400 ;K++)
    {
            printf("%x", array[K]);
            printf("%x", array[K+2]);
            if((K+1)%40==0)
            printf(";\r\n");
    }
 
                       
cs

Outcomes