Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dflet
Date:
Wed Jul 01 22:45:49 2015 +0000
Parent:
4:c27adffcfec2
Child:
6:37fb696395d7
Commit message:
WIP commit 6

Changed in this revision

FreeRTOS/FreeRTOSConfig.h Show annotated file Show diff for this revision Revisions of this file
camera_app/camera_app.cpp Show annotated file Show diff for this revision Revisions of this file
camera_app/httpserverapp/httpserverapp.cpp Show annotated file Show diff for this revision Revisions of this file
camera_app/mt9d111/i2cconfig.cpp Show annotated file Show diff for this revision Revisions of this file
camera_app/stm32f4xx_msp.c Show diff for this revision Revisions of this file
http/server/WebSockHandler.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
utils/app_config.h Show annotated file Show diff for this revision Revisions of this file
--- a/FreeRTOS/FreeRTOSConfig.h	Tue Jun 30 22:51:05 2015 +0000
+++ b/FreeRTOS/FreeRTOSConfig.h	Wed Jul 01 22:45:49 2015 +0000
@@ -86,7 +86,7 @@
 #define configCPU_CLOCK_HZ			( ( unsigned long ) SystemCoreClock )
 #define configTICK_RATE_HZ			( ( portTickType ) 1000 )
 #define configMINIMAL_STACK_SIZE	( ( unsigned short ) 130 )
-#define configTOTAL_HEAP_SIZE		( ( size_t ) (5 * 1024) )
+#define configTOTAL_HEAP_SIZE		( ( size_t ) (8 * 1024) )
 #define configMAX_TASK_NAME_LEN		( 16 )
 #define configUSE_TRACE_FACILITY	1
 #define configUSE_16_BIT_TICKS		0
--- a/camera_app/camera_app.cpp	Tue Jun 30 22:51:05 2015 +0000
+++ b/camera_app/camera_app.cpp	Wed Jul 01 22:45:49 2015 +0000
@@ -41,7 +41,7 @@
 //! @{
 //
 //*****************************************************************************
-//#include "mbed.h"
+#include "mbed.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -49,8 +49,9 @@
 // SimpleLink include
 #include "cc3100_simplelink.h"
 
-//#include "stm32f4xx_hal_dma.h"
-//#include "stm32f4xx_hal_dcmi.h"
+#include "stm32f4xx_hal_dma.h"
+#include "stm32f4xx_hal_dcmi.h"
+//#include "stm32f4xx.h"
 
 #include "camera_app.h"
 #include "mt9d111.h"
@@ -73,6 +74,11 @@
 //*****************************************************************************
 //                      GLOBAL VARIABLES
 //*****************************************************************************
+
+using namespace mbed_cc3100;
+
+cc3100 _cc3100_Module_(NC, NC, PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
+
 unsigned int g_frame_size_in_bytes;
 unsigned int g_uiDeviceModeConfig = ROLE_AP; //default is AP mode 
 extern volatile unsigned char g_CaptureImage;
@@ -347,12 +353,13 @@
 //!                               
 //
 //*****************************************************************************
-
+DCMI_HandleTypeDef phdcmi;
+DMA_HandleTypeDef hdma_dcmi;
 static unsigned short CaptureImage(char** WriteBuffer)
 {
     Uart_Write((uint8_t*)"CaptureImage \n\r");
-    DCMI_HandleTypeDef hdcmi;
-    DMA_HandleTypeDef hdma_dcmi;
+//    DCMI_HandleTypeDef phdcmi;
+//    DMA_HandleTypeDef hdma_dcmi;
     memset(g_image.g_image_buffer,0xF80F,sizeof(g_image.g_image_buffer));
     p_buffer = &(g_image.g_image_buffer[0]);
 
@@ -361,25 +368,27 @@
     //
     // Perform Image Capture 
     //
-    Uart_Write((uint8_t*)"CaptureImage Start\n\r");
+//    Uart_Write((uint8_t*)"CaptureImage Start\n\r");
+//    printf("CaptureImage Memory Start = 0x%x\n\r",p_buffer);
     
     /* Enable the DCMI */
 //    __HAL_DCMI_ENABLE(&hdcmi);
     /* Enable the DMA */
 //    __HAL_DMA_ENABLE(&hdma_dcmi);
     
-    HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
-    HAL_NVIC_EnableIRQ(DCMI_IRQn);
-    wait(1);
-    printf("\r\nBuffer size = %d\r\n",sizeof(g_image.g_image_buffer));
-    HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, sizeof(g_image.g_image_buffer)); 
+//    HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
+//    HAL_NVIC_EnableIRQ(DCMI_IRQn);
+//    wait(1);
+//    printf("\r\nBuffer size = %d\r\n",sizeof(g_image.g_image_buffer));
+    Uart_Write((uint8_t*)"CaptureImage Start\n\r");
+    HAL_DCMI_Start_DMA(&phdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, sizeof(g_image.g_image_buffer)); 
     
     /* Wait for frame */
-    while ((DCMI->CR & DCMI_CR_CAPTURE) != 0) {
-         GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
-    }
-    HAL_NVIC_DisableIRQ(DCMI_IRQn);
-    HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
+//    while ((DCMI->CR & DCMI_CR_CAPTURE) != 0) {
+//         GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
+//    }
+//    HAL_NVIC_DisableIRQ(DCMI_IRQn);
+//    HAL_NVIC_DisableIRQ(DMA2_Stream1_IRQn);
     
     /* Disable the DMA */
 //    __HAL_DMA_DISABLE(&hdma_dcmi);
@@ -396,7 +405,11 @@
  
     /* Read the number of data items transferred */
     uint16_t image_size = (FRAME_SIZE_IN_BYTES - hdma_dcmi.Instance->NDTR)*4;      
-    printf("image_size = %d\r\n",image_size);
+//    printf("image_size = 0x%x\r\n",image_size);
+    g_dma_txn_done = 1;
+    g_frame_size_in_bytes = image_size;
+    g_total_dma_intrpts = 1;
+    
     //
     // Create JPEG Header
     //
@@ -430,45 +443,177 @@
 static void DMAConfig()
 {
     Uart_Write((uint8_t*)"DMAConfig \n\r");
-//    memset(g_image.g_image_buffer,0xF80F,sizeof(g_image.g_image_buffer));
-//    p_buffer = &(g_image.g_image_buffer[0]);
-    //
-    // Initilalize DMA 
-    //
-//    UDMAInit();
-    //
-    // Setup ping-pong transfer
-    //
-//    UDMASetupTransfer(UDMA_CH22_CAMERA,UDMA_MODE_PINGPONG,TOTAL_DMA_ELEMENTS,UDMA_SIZE_32,
-//                     UDMA_ARB_8,(void *)CAM_BUFFER_ADDR, UDMA_SRC_INC_32,
-//                     (void *)p_buffer, UDMA_DST_INC_32);
-    //
-    //  Pong Buffer
-    // 
-//    p_buffer += TOTAL_DMA_ELEMENTS; 
-//    UDMASetupTransfer(UDMA_CH22_CAMERA|UDMA_ALT_SELECT,UDMA_MODE_PINGPONG,TOTAL_DMA_ELEMENTS,
-//                     UDMA_SIZE_32, UDMA_ARB_8,(void *)CAM_BUFFER_ADDR,
-//                     UDMA_SRC_INC_32, (void *)p_buffer, UDMA_DST_INC_32);
-    //
-    //  Ping Buffer
-    // 
-//    p_buffer += TOTAL_DMA_ELEMENTS; 
+    
+    /* Peripheral DMA init*/
+    /* DMA controller clock enable */
+    __DMA2_CLK_ENABLE();
+  
+    hdma_dcmi.Instance                 = DMA2_Stream1;
+    hdma_dcmi.Init.Channel             = DMA_CHANNEL_1;
+    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_BYTE;
+    hdma_dcmi.Init.MemDataAlignment    = DMA_MDATAALIGN_BYTE;
+    hdma_dcmi.Init.Mode                = DMA_CIRCULAR;
+    hdma_dcmi.Init.Priority            = DMA_PRIORITY_HIGH;
+    hdma_dcmi.Init.FIFOMode            = DMA_FIFOMODE_DISABLE;
+    hdma_dcmi.Init.FIFOThreshold       = DMA_FIFO_THRESHOLD_FULL;
+    hdma_dcmi.Init.MemBurst            = DMA_MBURST_SINGLE;
+    hdma_dcmi.Init.PeriphBurst         = DMA_PBURST_SINGLE;
+//    HAL_DMA_Init(&hdma_dcmi);
+    
+    __HAL_LINKDMA(&phdcmi,DMA_Handle,hdma_dcmi);
+    
+     /* DMA interrupt init */
+    HAL_NVIC_SetPriority(DMA2_Stream1_IRQn, 1, 0);
+    HAL_NVIC_EnableIRQ(DMA2_Stream1_IRQn);
+ 
+    phdcmi.Instance = DCMI;
+    phdcmi.Init.SynchroMode      = DCMI_SYNCHRO_HARDWARE;
+    phdcmi.Init.PCKPolarity      = DCMI_PCKPOLARITY_RISING;//FALLING
+    phdcmi.Init.VSPolarity       = DCMI_VSPOLARITY_LOW;
+    phdcmi.Init.HSPolarity       = DCMI_HSPOLARITY_LOW;
+    phdcmi.Init.CaptureRate      = DCMI_CR_ALL_FRAME;
+    phdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
+#ifdef ENABLE_JPEG  
+    phdcmi.Init.JPEGMode = DCMI_JPEG_ENABLE;
+#else
+    phdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;
+#endif
+ 
+//    HAL_DCMI_Init(&phdcmi); 
+    
+
+  GPIO_InitTypeDef GPIO_InitStruct;
+  if(phdcmi.Instance==DCMI)
+  {
+   __GPIOE_CLK_ENABLE();
+   __GPIOA_CLK_ENABLE();
+   __GPIOB_CLK_ENABLE();
+   __GPIOC_CLK_ENABLE();  
+   __GPIOH_CLK_ENABLE(); //Enable HSE Clock 8MHz  
+      
+   /**MCO2 GPIO Configuration 
+    PC9     ------> MCO2    
+    */
+       
+  /* USER CODE BEGIN DCMI_MspInit 0 */
+
+  /* USER CODE END DCMI_MspInit 0 */
+    /* Peripheral clock enable */
+    __DCMI_CLK_ENABLE();
+  
+    /**DCMI GPIO Configuration    
+    PE4     ------> DCMI_D4
+    PE5     ------> DCMI_D6
+    PE6     ------> DCMI_D7
+    PA4     ------> DCMI_HSYNC
+    PA6     ------> DCMI_PIXCK
+    PC8     ------> DCMI_D2
+    PE1     ------> DCMI_D3
+    PA9     ------> DCMI_D0
+    PA10    ------> DCMI_D1
+    PB6     ------> DCMI_D5
+    PB7     ------> DCMI_VSYNC 
+    */
+    GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6;
+    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
+    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
+
+    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9|GPIO_PIN_10;
+    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
+    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+    GPIO_InitStruct.Pin = GPIO_PIN_8;
+    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
+    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+    
+    /*Configure GPIO pin : GPIO_AF0_MCO PC9 */
+    GPIO_InitStruct.Pin = GPIO_PIN_9;
+    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
+    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
+
+    GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
+    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
+    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
+    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+  /* System interrupt init*/
+    HAL_NVIC_SetPriority(DCMI_IRQn, 1, 0);
+    HAL_NVIC_EnableIRQ(DCMI_IRQn);
+
+    HAL_DMA_Init(&hdma_dcmi);
+    HAL_DCMI_Init(&phdcmi);
+    
+    }
 
     g_dma_txn_done = 0;
     g_frame_size_in_bytes = 0;
     g_frame_end = 0;
     g_total_dma_intrpts = 0;
+}
 
-    //
-    // Clear any pending interrupt
-    //
-//    CameraIntClear(CAMERA_BASE,CAM_INT_DMA);
+void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* phdcmi){
+
+  if(phdcmi->Instance==DCMI)
+  {
+  /* USER CODE BEGIN DCMI_MspDeInit 0 */
 
-    //
-    // DMA Interrupt unmask from apps config
-    //
-//    CameraIntEnable(CAMERA_BASE,CAM_INT_DMA);
-}
+  /* USER CODE END DCMI_MspDeInit 0 */
+    /* Peripheral clock disable */
+    __DCMI_CLK_DISABLE();
+  
+    /**DCMI GPIO Configuration    
+    PE4     ------> DCMI_D4
+    PE5     ------> DCMI_D6
+    PE6     ------> DCMI_D7
+    PA4     ------> DCMI_HSYNC
+    PA6     ------> DCMI_PIXCK
+    PC8     ------> DCMI_D2
+    PE1     ------> DCMI_D3
+    PA9     ------> DCMI_D0
+    PA10    ------> DCMI_D1
+    PB6     ------> DCMI_D5
+    PB7     ------> DCMI_VSYNC 
+    
+    PE1     ------> MCO2
+    */    
+    
+    HAL_GPIO_DeInit(GPIOE, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6);
+
+    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9|GPIO_PIN_10);
+
+    HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9|GPIO_PIN_8);
+
+    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
+
+    /* Peripheral DMA DeInit*/
+    HAL_DMA_DeInit(phdcmi->DMA_Handle);
+
+    /* Peripheral interrupt DeInit*/
+    HAL_NVIC_DisableIRQ(DCMI_IRQn);
+
+  /* USER CODE BEGIN DCMI_MspDeInit 1 */
+
+  /* USER CODE END DCMI_MspDeInit 1 */
+  }
+
+}		
 
 //*****************************************************************************
 //
@@ -483,7 +628,6 @@
 static void CamControllerInit()
 {
 	  Uart_Write((uint8_t*)"CamControllerInit \n\r");
-//	  DCMI_HandleTypeDef hdcmi;
 //    MAP_PRCMPeripheralClkEnable(PRCM_CAMERA, PRCM_RUN_MODE_CLK);
 //    MAP_PRCMPeripheralReset(PRCM_CAMERA);
 
@@ -531,8 +675,7 @@
 static void CameraIntHandler()
 {
 	Uart_Write((uint8_t*)"CameraIntHandler \n\r");
-//	DCMI_HandleTypeDef hdcmi;
-//    DMA_HandleTypeDef hdma_dcmi;
+
 	//MAP_CameraIntClear(CAMERA_BASE, CAM_INT_FE);
  //   if(g_total_dma_intrpts > 1 && MAP_CameraIntStatus(CAMERA_BASE) & CAM_INT_FE)
 //    {
@@ -578,15 +721,11 @@
 //            g_frame_end = 1;
 //        }
 //    }
-    /* Enable DMA2 stream 1 and DCMI interface then start image capture */
-//  DMA_Cmd(DMA2_Stream1, ENABLE); 
-//  DCMI_Cmd(ENABLE); 
+
 
   /* Insert 100ms delay: wait 100ms */
 //  wait_ms(100); 
 
-//  DCMI_CaptureCmd(ENABLE);
-//HAL_DCMI_Start_DMA(hdcmi, DCMI_MODE_SNAPSHOT, WriteBuffer, Length) 
 }
 
 //*****************************************************************************
--- a/camera_app/httpserverapp/httpserverapp.cpp	Tue Jun 30 22:51:05 2015 +0000
+++ b/camera_app/httpserverapp/httpserverapp.cpp	Wed Jul 01 22:45:49 2015 +0000
@@ -64,6 +64,7 @@
 #include "cli_uart.h"
 #include "app_config.h"
 #include "myBoardInit.h"
+#include "HttpDebug.h"
 
 using namespace mbed_cc3100;
 
@@ -104,7 +105,7 @@
 		if(g_close == 0)
 		{
 			Write.uLength = StartCamera((char **)&Write.pData);
-
+            HttpDebug("Data Len = 0x%x \n\r",Write.uLength);
 			if(!sl_WebSocketSend(g_uConnection, Write, Opcode))
 			{
 				Uart_Write((uint8_t*)"sl_WebSocketSend fsiled.\n\r");
--- a/camera_app/mt9d111/i2cconfig.cpp	Tue Jun 30 22:51:05 2015 +0000
+++ b/camera_app/mt9d111/i2cconfig.cpp	Wed Jul 01 22:45:49 2015 +0000
@@ -62,7 +62,7 @@
 //*****************************************************************************
 uint32_t I2CInit()
 {
-    Uart_Write((uint8_t*)"I2CInit \n\r");
+//    Uart_Write((uint8_t*)"I2CInit \n\r");
     i2c.frequency (400000); 
 
     return 0;
--- a/camera_app/stm32f4xx_msp.c	Tue Jun 30 22:51:05 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,227 +0,0 @@
-/**
-  ******************************************************************************
-  * File Name          : stm32f4xx_hal_msp.c
-  * Date               : 13/06/2015 17:58:06
-  * Description        : This file provides code for the MSP Initialization 
-  *                      and de-Initialization codes.
-  ******************************************************************************
-  *
-  * COPYRIGHT(c) 2015 STMicroelectronics
-  *
-  * Redistribution and use in source and binary forms, with or without modification,
-  * are permitted provided that the following conditions are met:
-  *   1. Redistributions of source code must retain the above copyright notice,
-  *      this list of conditions and the following disclaimer.
-  *   2. Redistributions in binary form must reproduce the above copyright notice,
-  *      this list of conditions and the following disclaimer in the documentation
-  *      and/or other materials provided with the distribution.
-  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-  *      may be used to endorse or promote products derived from this software
-  *      without specific prior written permission.
-  *
-  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-  *
-  ******************************************************************************
-  */
-/* Includes ------------------------------------------------------------------*/
-#include "stm32f4xx_hal.h"
-//#include "cli_uart.h"
-
-extern DMA_HandleTypeDef hdma_dcmi;
-
-
-/* USER CODE BEGIN 0 */
-
-/* USER CODE END 0 */
-
-/**
-  * Initializes the Global MSP.
-  */
-//void HAL_MspInit(void)
-//{
-  /* USER CODE BEGIN MspInit 0 */
-
-  /* USER CODE END MspInit 0 */
-
-//  HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
-
-  /* System interrupt init*/
-/* SysTick_IRQn interrupt configuration */
-//  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
-
-  /* USER CODE BEGIN MspInit 1 */
-
-  /* USER CODE END MspInit 1 */
-//}
-
-void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi)
-{
-
-  GPIO_InitTypeDef GPIO_InitStruct;
-//  if(hdcmi->Instance==DCMI)
-//  {
-   __GPIOE_CLK_ENABLE();
-   __GPIOA_CLK_ENABLE();
-   __GPIOB_CLK_ENABLE();
-   __GPIOC_CLK_ENABLE();  
-   __GPIOH_CLK_ENABLE(); //Enable HSE Clock 8MHz  
-      
-   /**MCO2 GPIO Configuration 
-    PC9     ------> MCO2    
-    */
-       
-  /* USER CODE BEGIN DCMI_MspInit 0 */
-
-  /* USER CODE END DCMI_MspInit 0 */
-    /* Peripheral clock enable */
-    __DCMI_CLK_ENABLE();
-  
-    /**DCMI GPIO Configuration    
-    PE4     ------> DCMI_D4
-    PE5     ------> DCMI_D6
-    PE6     ------> DCMI_D7
-    PA4     ------> DCMI_HSYNC
-    PA6     ------> DCMI_PIXCK
-    PC8     ------> DCMI_D2
-    PE1     ------> DCMI_D3
-    PA9     ------> DCMI_D0
-    PA10    ------> DCMI_D1
-    PB6     ------> DCMI_D5
-    PB7     ------> DCMI_VSYNC 
-    */
-    GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
-    HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
-
-    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9|GPIO_PIN_10;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
-    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
-    GPIO_InitStruct.Pin = GPIO_PIN_8;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
-    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
-    
-    /*Configure GPIO pin : GPIO_AF0_MCO PC9 */
-    GPIO_InitStruct.Pin = GPIO_PIN_9;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Alternate = GPIO_AF0_MCO;
-    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
-
-    GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
-    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
-    GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
-    GPIO_InitStruct.Alternate = GPIO_AF13_DCMI;
-    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
-    /* Peripheral DMA init*/
-  
-    hdma_dcmi.Instance = DMA2_Stream1;
-    hdma_dcmi.Init.Channel = DMA_CHANNEL_1;
-    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_BYTE;
-    hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
-    hdma_dcmi.Init.Mode = DMA_NORMAL;//DMA_CIRCULAR;
-    hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
-    hdma_dcmi.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
-    hdma_dcmi.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
-    hdma_dcmi.Init.MemBurst = DMA_MBURST_SINGLE;
-    hdma_dcmi.Init.PeriphBurst = DMA_PBURST_SINGLE;
-    
-    __HAL_LINKDMA(hdcmi,DMA_Handle,hdma_dcmi);
-
-  /* System interrupt init*/
-    HAL_NVIC_SetPriority(DCMI_IRQn, 5, 5);
-//    HAL_NVIC_EnableIRQ(DCMI_IRQn);
-  /* USER CODE BEGIN DCMI_MspInit 1 */
-
-  /* USER CODE END DCMI_MspInit 1 */
-//  }
-    HAL_DMA_Init(&hdma_dcmi);
-
-}
-
-void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi)
-{
-
-  if(hdcmi->Instance==DCMI)
-  {
-  /* USER CODE BEGIN DCMI_MspDeInit 0 */
-
-  /* USER CODE END DCMI_MspDeInit 0 */
-    /* Peripheral clock disable */
-    __DCMI_CLK_DISABLE();
-  
-    /**DCMI GPIO Configuration    
-    PE4     ------> DCMI_D4
-    PE5     ------> DCMI_D6
-    PE6     ------> DCMI_D7
-    PA4     ------> DCMI_HSYNC
-    PA6     ------> DCMI_PIXCK
-    PC8     ------> DCMI_D2
-    PE1     ------> DCMI_D3
-    PA9     ------> DCMI_D0
-    PA10    ------> DCMI_D1
-    PB6     ------> DCMI_D5
-    PB7     ------> DCMI_VSYNC 
-    
-    PE1     ------> MCO2
-    */    
-    
-    HAL_GPIO_DeInit(GPIOE, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6);
-
-    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_6|GPIO_PIN_9|GPIO_PIN_10);
-
-    HAL_GPIO_DeInit(GPIOC, GPIO_PIN_9|GPIO_PIN_8);
-
-    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7);
-
-    /* Peripheral DMA DeInit*/
-    HAL_DMA_DeInit(hdcmi->DMA_Handle);
-
-    /* Peripheral interrupt DeInit*/
-    HAL_NVIC_DisableIRQ(DCMI_IRQn);
-
-  /* USER CODE BEGIN DCMI_MspDeInit 1 */
-//  Uart_Write((uint8_t*)"\n\rHAL_DCMI_MspDeInit complete \n\r");
-  /* USER CODE END DCMI_MspDeInit 1 */
-  }
-
-}
-
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */
-
-/**
-  * @}
-  */
-
-/**
-  * @}
-  */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
-
--- a/http/server/WebSockHandler.cpp	Tue Jun 30 22:51:05 2015 +0000
+++ b/http/server/WebSockHandler.cpp	Wed Jul 01 22:45:49 2015 +0000
@@ -290,7 +290,7 @@
  */
 int WSCore_DataSend(UINT16 uConnection, struct HttpBlob PayLoad, UINT8 Opcode)
 {
-	Uart_Write((uint8_t*)"WSCore_DataSend.\n\r");
+	Uart_Write((uint8_t*)"WSCore_DataSend\n\r");
 	UINT16 usTotalLength;
 	UINT8 usNextBlock;
 	UINT16 usPayloadLen;	// The heap cannot support beyond 65kb
--- a/main.cpp	Tue Jun 30 22:51:05 2015 +0000
+++ b/main.cpp	Wed Jul 01 22:45:49 2015 +0000
@@ -90,8 +90,8 @@
   /* USER CODE END MspInit 1 */
 //}
  
-DCMI_HandleTypeDef hdcmi;
-DMA_HandleTypeDef hdma_dcmi;
+//DCMI_HandleTypeDef hdcmi;
+//DMA_HandleTypeDef hdma_dcmi;
 
 /** System Clock Configuration
 */
@@ -159,6 +159,8 @@
  
 void MX_DCMI_Init()
 {
+  DCMI_HandleTypeDef hdcmi;
+  DMA_HandleTypeDef hdma_dcmi;
 
   hdcmi.Instance = DCMI;
   hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
@@ -278,9 +280,9 @@
    CLI_Configure();
    
 /* Initialize all configured peripherals */
-   MX_DMA_Init();
-   MX_DCMI_Init();
-   initLEDs();
+//   MX_DMA_Init();
+//   MX_DCMI_Init();
+//   initLEDs();
 
 //   toggleLed(1);
 //#ifndef NOTERM
@@ -341,6 +343,11 @@
 extern "C" void HardFault_Handler(void)
 {
   /* Go to infinite loop when Hard Fault exception occurs */
+  printf("Hard Fault Register SCB->HSFR     0x%X \r\n",SCB->HFSR);
+  printf("Call to Memory Address SCB->BFAR  0x%X ERROR!\r\n",SCB->BFAR);
+  printf("Fault bits set SCB->CFSR          0x%X \r\n",SCB->CFSR);
+  printf("Call to Memory Address SCB->MMFAR 0x%X ERROR!\r\n",SCB->MMFAR);
+  
   Uart_Write((uint8_t*)"HardFault_Handler \n\r");
   while (1)
   {
@@ -440,6 +447,8 @@
   */
 void DMA2_Stream1_IRQHandler(void)
 {
+  DCMI_HandleTypeDef hdcmi;
+  DMA_HandleTypeDef hdma_dcmi;
   Uart_Write((uint8_t*)"DMA2_Stream1_IRQHandler \n\r");
   HAL_DMA_IRQHandler(&hdma_dcmi);  
 }
@@ -451,6 +460,8 @@
   */
 void DCMI_IRQHandler(void)
 {
+  DCMI_HandleTypeDef hdcmi;
+  DMA_HandleTypeDef hdma_dcmi;
   Uart_Write((uint8_t*)"DCMI_IRQHandler \n\r");
   HAL_DCMI_IRQHandler(&hdcmi);
 }
--- a/utils/app_config.h	Tue Jun 30 22:51:05 2015 +0000
+++ b/utils/app_config.h	Wed Jul 01 22:45:49 2015 +0000
@@ -4,8 +4,8 @@
 
 
 #define SPAWN_TASK_PRIORITY            7//9
-#define HTTP_SERVER_APP_TASK_PRIORITY  2//1
-#define CAMERA_SERVICE_PRIORITY        2
+#define HTTP_SERVER_APP_TASK_PRIORITY  1//1
+#define CAMERA_SERVICE_PRIORITY        1
 #define OSI_STACK_SIZE                 2048