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.
Revision 17:acc075ff3fcb, committed 2015-08-31
- Comitter:
- dflet
- Date:
- Mon Aug 31 15:20:36 2015 +0000
- Parent:
- 16:7e5aab2fabba
- Child:
- 18:3f1b52616d00
- Commit message:
- Changed SPI mode from 1 to mode 0. Mode 0 is correct. Note: may be some clk skew here mode 0 & 1 work???, spi still flacky when mco1 is turned on. Doing some off app testing to try and get the mt9d111 cam working. Removed some debug.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
simplelink/cc3100_spi.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sun Aug 30 21:10:11 2015 +0000 +++ b/main.cpp Mon Aug 31 15:20:36 2015 +0000 @@ -49,22 +49,14 @@ #include "cc3100_simplelink.h" #include "cc3100.h" -#include "httpserverapp.h" - -//#include "stm32f4xx_hal.h" -//#include "stm32f4xx_hal_rcc.h" - /* Free-RTOS includes */ #include "FreeRTOS.h" -//#include "task.h" -//#include "semphr.h" -//#include "portmacro.h" - #include "osi.h" #include "cli_uart.h" #include "app_config.h" #include "myBoardInit.h" +#include "httpserverapp.h" #include "camera_app.h" using namespace mbed_cc3100; @@ -83,7 +75,6 @@ /* Off board leds */ DigitalOut led1(PB_15); DigitalOut led2(PB_14); -//Serial pc(USBTX, USBRX); 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 static void Start_MCO1(void); @@ -122,13 +113,13 @@ GPIO_InitStruct.Alternate = GPIO_AF0_MCO; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); -// #ifndef MT9D111_CAM +#ifndef MT9D111_CAM /* MCO1 output 16MHz */ -// HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); -//#else + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_1); +#else /* MCO1 output 8MHz */ -// HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_2); -//#endif + HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSI, RCC_MCODIV_2); +#endif wait_ms(500); } @@ -194,9 +185,7 @@ initLEDs(); -// toggleLed(1); -//#ifndef NOTERM - +//#ifndef NOTERM memset(print_buf, 0x00, PRINT_BUF_LEN); sprintf((char*) print_buf, " \r\nSystemCoreClock = %dMHz\r\n ", SystemCoreClock /1000000); rv = Uart_Write((uint8_t *) print_buf); @@ -224,7 +213,6 @@ // Start the HttpServer Task // // - osi_TaskCreate(HttpServerAppTask, "WebSocketApp", OSI_STACK_SIZE,
--- a/simplelink/cc3100_spi.cpp Sun Aug 30 21:10:11 2015 +0000 +++ b/simplelink/cc3100_spi.cpp Mon Aug 31 15:20:36 2015 +0000 @@ -54,8 +54,8 @@ : /*_sw1_irq(button1_irq), _sw2_irq(button2_irq),*/ _wlan_irq(cc3100_irq), _wlan_nHIB(cc3100_nHIB), _wlan_cs(cc3100_cs), _wlan_spi(cc3100_spi), _driver(driver) { - _wlan_spi.format(8,1); - _wlan_spi.frequency(16000000); + _wlan_spi.format(8,0);//Note Mode 0 + _wlan_spi.frequency(12000000); _wlan_irq.rise(this, &cc3100_spi::IntSpiGPIOHandler); //_SlDrvRxIrqHandler is called from IntSpiGPIOHandler // _sw1_irq.rise(this, &cc3100_spi::buttonHandler_1); // _sw2_irq.rise(this, &cc3100_spi::buttonHandler_2); @@ -126,9 +126,6 @@ Fd_t cc3100_spi::spi_Open(int8_t *ifName, uint32_t flags) { - // 50 ms delay - // wait_ms(50); - // Enable WLAN interrupt cc3100_InterruptEnable(); @@ -138,16 +135,14 @@ int cc3100_spi::spi_Write(Fd_t fd, uint8_t *pBuff, int len) { int len_to_return = len; -// Uart_Write((uint8_t*)"Write\r\n"); + _wlan_cs = 0; -// for(int i = 0;i<len;i++){ -// printf(" %x",pBuff[i]); -// } + while(len) { _wlan_spi.write(*pBuff++); len--; } -// printf("\r\n"); + _wlan_cs = 1; return len_to_return; @@ -156,21 +151,20 @@ int cc3100_spi::spi_Read(Fd_t fd, uint8_t *pBuff, int len) { int i = 0; -// Uart_Write((uint8_t*)"Read\r\n"); + _wlan_cs = 0; for (i = 0; i < len; i++) { pBuff[i] = _wlan_spi.write(0xFF); -// printf(" %x",pBuff[i]); } -// printf("\r\n"); + _wlan_cs = 1; return len; } void cc3100_spi::IntSpiGPIOHandler(void) { -// Uart_Write((uint8_t*)"Int\r\n"); + if(_wlan_irq){ _driver._SlDrvRxIrqHandler(0); }