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:
Mon Jul 06 20:43:17 2015 +0000
Parent:
8:529a12812c53
Child:
10:f2447c682c0f
Commit message:
WIP commit 10

Changed in this revision

camera_app/camera_app.cpp Show annotated file Show diff for this revision Revisions of this file
camera_app/camera_app.h 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
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/camera_app/camera_app.cpp	Mon Jul 06 11:03:14 2015 +0000
+++ b/camera_app/camera_app.cpp	Mon Jul 06 20:43:17 2015 +0000
@@ -339,18 +339,22 @@
     //
     // Perform Image Capture 
     //
-
-    HAL_DCMI_Start_DMA(&phdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, FRAME_SIZE_IN_BYTES/4); 
+//    wait_ms(500);
+    HAL_DCMI_Start_DMA(&phdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, NUM_OF_4B_CHUNKS);
+//    HAL_DCMI_Start_DMA(&phdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)p_buffer, FRAME_SIZE_IN_BYTES/4); 
     g_frame_end = 1;
  
     /* Read the number of data items transferred */
-    g_frame_size_in_bytes = (FRAME_SIZE_IN_BYTES - (hdma_dcmi.Instance->NDTR*4));
+//    g_frame_size_in_bytes = (FRAME_SIZE_IN_BYTES - (hdma_dcmi.Instance->NDTR*4));
+    g_frame_size_in_bytes = 4*(NUM_OF_4B_CHUNKS - hdma_dcmi.Instance->NDTR);
     g_dma_txn_done = 1;
     g_total_dma_intrpts = 1;
     
+    HttpDebug("g_frame_size_in_bytes = 0x%x \r\n",g_frame_size_in_bytes);
+    
     uint8_t* Image_Array = reinterpret_cast<uint8_t*>(&g_image.g_image_buffer);
 #if 0    
-    for(int i =0;i< 100;i++){
+    for(int i =0;i< 10;i++){
     	HttpDebug("0x%x ",Image_Array[i]);
     }
 #endif//if 0    
--- a/camera_app/camera_app.h	Mon Jul 06 11:03:14 2015 +0000
+++ b/camera_app/camera_app.h	Mon Jul 06 20:43:17 2015 +0000
@@ -75,7 +75,7 @@
 #define MAX_EMAIL_ID_LENGTH         34
 #define SMTP_BUF_LEN                1024
 
-#define CAM_BT_CORRECT_EN   0x00001000
+//#define CAM_BT_CORRECT_EN   0x00001000
 
 typedef enum opcd{
     START_CAPTURE = 1,
--- a/camera_app/httpserverapp/httpserverapp.cpp	Mon Jul 06 11:03:14 2015 +0000
+++ b/camera_app/httpserverapp/httpserverapp.cpp	Mon Jul 06 20:43:17 2015 +0000
@@ -68,11 +68,8 @@
 
 using namespace mbed_cc3100;
 
-
-//cc3100 _cc3100_Mod(NC, NC, PE_5, PE_4, PE_6, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
 cc3100 _cc3100_Mod(NC, NC, PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
 
-
 /****************************************************************************/
 /*				MACROS										*/
 /****************************************************************************/
@@ -108,7 +105,7 @@
 		if(g_close == 0)
 		{
 			Write.uLength = StartCamera((char **)&Write.pData);
-//            HttpDebug("Data Len = 0x%x \n\r",Write.pData);
+//            HttpDebug("Data Len = 0x%x \n\r",Write.uLength);
 			if(!sl_WebSocketSend(g_uConnection, Write, Opcode))
 			{
 				Uart_Write((uint8_t*)"sl_WebSocketSend failed.\n\r");
--- a/main.cpp	Mon Jul 06 11:03:14 2015 +0000
+++ b/main.cpp	Mon Jul 06 20:43:17 2015 +0000
@@ -102,7 +102,7 @@
   HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
   
   //Used for ov7670 test
-  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S;
+  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_PLLI2S;//|RCC_PERIPHCLK_I2S;
   PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
   PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
   HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
@@ -148,7 +148,7 @@
 /* Off board leds */
   DigitalOut led1(PB_15);
   DigitalOut led2(PB_14);
-//cc3100 _cc3100(NC, NC, PE_5, PE_4, PE_6, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
+
 cc3100 _cc3100(NC, NC, PD_12, PD_13, PD_11, SPI(PB_5, PB_4, PB_3));//Seeed_Arch_Max  irq, nHib, cs, mosi, miso, sck
 
 void initLEDs(void);
--- a/utils/app_config.h	Mon Jul 06 11:03:14 2015 +0000
+++ b/utils/app_config.h	Mon Jul 06 20:43:17 2015 +0000
@@ -4,8 +4,8 @@
 
 
 #define SPAWN_TASK_PRIORITY            7//9
-#define HTTP_SERVER_APP_TASK_PRIORITY  1//1
-#define CAMERA_SERVICE_PRIORITY        1
+#define HTTP_SERVER_APP_TASK_PRIORITY  2//1
+#define CAMERA_SERVICE_PRIORITY        2
 #define OSI_STACK_SIZE                 2048