Staging:CC3220 Camera Application

Objective
This application demonstrates Camera Application on a CC3220 LaunchPad setup. This application captures QVGA image in JPEG format and displays in a web browser.

Hardware

 * CC3220 LaunchPad
 * CC32XX Camera Booster Pack Rev 3.0 onwards
 * MT9D111 Camera Module

Software

 * CC3220 Camera Application
 * Latest SDK Firmware Package

Application details
In this application, Simplelink device runs in Access Point Mode.

User needs to connect the Wi-Fi enabled device PC/Smartphone to the device AP (Default SSID: mysimplelink-MACAddr)

Using a web browser, access http://mysimplelink.net/camera_demo.html, the static pages stored on Serial FLASH will be displayed.

Press/Click 'Start' button to start capturing. The captured image will be written to Serial FLASH and displayed in the web browser.

Source Files briefly explained

 * main.c - System Initialization, Spawns the Camera Service Task. HTTP server callback request to handle token from HTML page.
 * cc_launchpad.c - Peripheral initialization.
 * pinmux.c - Generated by Pinmux utility pin to configure Camera Data and I2C
 * camera_app.c - Handles DMA Configuration, Camera Capture and NVMEM File operations
 * MT9D111.c - MT9D111 sensor related functions are implemented
 * jpegHeader.c - Create JPEG Header in JFIF format.
 * startup_*.c - Implements tools specific interrupt vector table

Usage

 * Flash Example Content(html,image,Application binary) on serial flash by following below steps.
 * Open Image Creator.
 * Open existing project or create new project.
 * Click on Connect button. [[Image:image_creator_connect.png|none]]
 * On successful connection to device, select Service Pack. [[Image:image_creator_select_service_pack.png|none]]
 * Browse service pack and select. [[Image:image_creator_browse_service_pack.png|none]]
 * Go to User Files tab. [[Image:image_creator_user_files.png|none]]
 * Create "www" folder if does not show in file list
 * From "Action" drop down select "New Folder" and click on "Create" button. [[Image:image_creator_new_folder_name.png|none]]
 * Enter folder name as www and click on "Create" button. [[Image:www_folder_create.png|none]]
 * Create "www/images" folder if doesn't exist
 * Check/Select "www" in file list. [[Image:image_creator_select_folder.png|none]]
 * From "Action" drop down select "New Folder" and click on "Create" button.
 * Enter folder name as images and click on "Create" button.
 * Create "www/js" folder if doesn't exist
 * Check/Select "www" in file list.
 * From "Action" drop down select "New Folder" and click on "Create" button.
 * Enter folder name as js.
 * Add "main.html"
 * Check/Select "www" in file list.
 * From "Action" drop down select "Upload File" and click on "Browse". [[Image:image_creator_select_upload_file.png|none]]
 * Browse to "\example\camera_application\html".
 * Select "main.html".
 * Add "camera_demo.html"
 * Check/Select "www" in file list.
 * From "Action" drop down select "Upload File" and click on "Browse".
 * Browse to "\example\camera_application\html".
 * Select "camera_demo.html".
 * Add "simple_link.css"
 * Check/Select "www" in file list.
 * From "Action" drop down select "Upload File" and click on "Browse".
 * Browse to "\example\camera_application\html".
 * Select "simple_link.css".
 * Add "ti_simplelink.jpg"
 * Expand "www" in file list by clicking on it. [[Image:image_creator_expand_folder.png|none]]
 * Check/Select "images" in file list.
 * From "Action" drop down select "Upload File" and click on "Browse".
 * Browse to "\example\camera_application\html\images".
 * Select "ti_simplelink.jpg".
 * Add " jquery-1.8.3.min.js"
 * Expand "www" in file list by clicking on it.
 * Check/Select "js" in file list.
 * From "Action" drop down select "Upload File" and click on "Browse".
 * Browse to "\example\camera_application\html\js".
 * Select " jquery-1.8.3.min.js".
 * Add MCU Image, if you want to run from flash
 * From "Action" drop down select "Select MCU Image" and click on browse. [[Image:image_creator_select_mcu_image.png|none]]
 * Browse to camera_application.bin file in your SDK.
 * Click on "Save Project" icon if you want to save project for future. [[Image:image_creator_save_project.png|none]]
 * Click on "Program Image" icon. [[Image:image_creator_program_image.png|none]]
 * Click on "Program Image(Create&Program)" button. [[Image:image_creator_generate_image_program_image.png|none]]


 * Configure the device as described in next section
 * Run the reference application
 * Run From IDE (IAR/CCS)
 * Open the Project as mentioned in the \docs\CC3220-Getting Started Guide.pdf
 * Build and download the application to the board
 * Run Flashed Binary file
 * Remove SOP Jumpers on Board and Press Reset. Refer \docs\CC3220-Getting Started Guide.pdf for detailed Information.


 * Device started in AP mode, Connect your PC/SmartPhone to 'mysimplelink-'.
 * Open 'mysimplelink.net/main.html' in browser of PC/MAC/Smartphone, goto 'Camera' tab and Control Camera Capture in the CC3220 device.

Configuring the target device
Please note that only one sensor has to be interfaced to the camera booster pack.
 * 1) Remove J10 and J11 jumpers to cut off the TDI and TDO from FTDI.
 * 2) Mount the jumpers J6 and J7 in the RX/TX mode. This enables the launchpad interface to the booster pack.
 * 3) Remove SOP-2 Jumper. For Debug(Using IAR/CCS) Mode, Ensure SOP 0 is mounted on the CC3220 launchpad. Since, TDI and TDO are used for I2C interface, the JTAG is operational in SWD mode. # Remove Jumpers J2, J3 and J4. This disconnects the GPIO from on-board sensors.[[Image:LP_Jumper_camera_swd.png|center|640x440px]]
 * 4) Mount the Camera Booster pack on the launchpad as shown below. Make sure the VCC on P1 connector mates with VCC indication on the booster pack. Similarly, the GND on P2 connector should align with GND indication on the camera booster pack.[[Image:LP_Camera_mount.jpg|thumb|center|480x440px]]

Limitations/Known Issues

 * The application requires about 250 KB space in serial Flash. Downloading html/bin files using Image Creator may fail if enough space is not available on serial.
 * There is significant lag in JPEG output since capture images are stored in serial flash and polled by web browser.