GS2K OV720p HD Full Duplex-Audio Video ADK Application Note

Page created by Bryan Payne
 
CONTINUE READING
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex-
          Audio Video ADK
           Application Note
             80560NT11584A Rev. 3.1 – 2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

SPECIFICATIONS ARE SUBJECT TO CHANGE WITHOUT NOTICE

NOTICE

While reasonable efforts have been made to assure the accuracy of this document, Telit
assumes no liability resulting from any inaccuracies or omissions in this document, or from
use of the information obtained herein. The information in this document has been carefully
checked and is believed to be reliable. However, no responsibility is assumed for
inaccuracies or omissions. Telit reserves the right to make changes to any products
described herein and reserves the right to revise this document and to make changes from
time to time in content hereof with no obligation to notify any person of revisions or changes.
Telit does not assume any liability arising out of the application or use of any product,
software, or circuit described herein; neither does it convey license under its patent rights or
the rights of others.
It is possible that this publication may contain references to, or information about Telit
products (machines and programs), programming, or services that are not announced in your
country. Such references or information must not be construed to mean that Telit intends to
announce such Telit products, programming, or services in your country.
COPYRIGHTS

This instruction manual and the Telit products described in this instruction manual may be,
include or describe copyrighted Telit material, such as computer programs stored in
semiconductor memories or other media. Laws in the Italy and other countries preserve for
Telit and its licensors certain exclusive rights for copyrighted material, including the exclusive
right to copy, reproduce in any form, distribute and make derivative works of the copyrighted
material. Accordingly, any copyrighted material of Telit and its licensors contained herein or in
the Telit products described in this instruction manual may not be copied, reproduced,
distributed, merged or modified in any manner without the express written permission of Telit.
Furthermore, the purchase of Telit products shall not be deemed to grant either directly or by
implication, estoppel, or otherwise, any license under the copyrights, patents or patent
applications of Telit, as arises by operation of law in the sale of a product.
COMPUTER SOFTWARE COPYRIGHTS

The Telit and 3rd Party supplied Software (SW) products described in this instruction manual
may include copyrighted Telit and other 3rd Party supplied computer programs stored in
semiconductor memories or other media. Laws in the Italy and other countries preserve for
Telit and other 3rd Party supplied SW certain exclusive rights for copyrighted computer
programs, including the exclusive right to copy or reproduce in any form the copyrighted
computer program. Accordingly, any copyrighted Telit or other 3rd Party supplied SW
computer programs contained in the Telit products described in this instruction manual may
not be copied (reverse engineered) or reproduced in any manner without the express written
permission of Telit or the 3rd Party SW supplier. Furthermore, the purchase of Telit products
shall not be deemed to grant either directly or by implication, estoppel, or otherwise, any
license under the copyrights, patents or patent applications of Telit or other 3rd Party supplied
SW, except for the normal non-exclusive, royalty free license to use that arises by operation
of law in the sale of a product.

80560NT11584A Rev. 3.1                    Page 2 of 69                                 2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

USAGE AND DISCLOSURE RESTRICTIONS
  I.   License Agreements

The software described in this document is the property of Telit and its licensors. It is
furnished by express license agreement only and may be used only in accordance with the
terms of such an agreement.
 II.   Copyrighted Materials

Software and documentation are copyrighted materials. Making unauthorized copies is
prohibited by law. No part of the software or documentation may be reproduced, transmitted,
transcribed, stored in a retrieval system, or translated into any language or computer
language, in any form or by any means, without prior written permission of Telit
III.   High Risk Materials

Components, units, or third-party products used in the product described herein are NOT
fault-tolerant and are NOT designed, manufactured, or intended for use as on-line control
equipment in the following hazardous environments requiring fail-safe controls: the operation
of Nuclear Facilities, Aircraft Navigation or Aircraft Communication Systems, Air Traffic
Control, Life Support, or Weapons Systems (High Risk Activities"). Telit and its supplier(s)
specifically disclaim any expressed or implied warranty of fitness for such High Risk Activities.
IV.    Trademarks

TELIT and the Stylized T Logo are registered in Trademark Office. All other product or service
names are the property of their respective owners.
 V.    Third Party Rights

The software may include Third Party Right software. In this case, you agree to comply with
all terms and conditions imposed on you in respect of such separate software. In addition to
Third Party Terms, the disclaimer of warranty and limitation of liability provisions in this
License shall apply to the Third Party Right software.
TELIT HEREBY DISCLAIMS ANY AND ALL WARRANTIES EXPRESS OR IMPLIED FROM
ANY THIRD PARTIES REGARDING ANY SEPARATE FILES, ANY THIRD PARTY
MATERIALS INCLUDED IN THE SOFTWARE, ANY THIRD PARTY MATERIALS FROM
WHICH THE SOFTWARE IS DERIVED (COLLECTIVELY “OTHER CODE”), AND THE USE
OF ANY OR ALL THE OTHER CODE IN CONNECTION WITH THE SOFTWARE,
INCLUDING (WITHOUT LIMITATION) ANY WARRANTIES OF SATISFACTORY QUALITY
OR FITNESS FOR A PARTICULAR PURPOSE.
NO THIRD PARTY LICENSORS OF OTHER CODE SHALL HAVE ANY LIABILITY FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
AND WHETHER MADE UNDER CONTRACT, TORT OR OTHER LEGAL THEORY,
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE OTHER CODE OR
THE EXERCISE OF ANY RIGHTS GRANTED UNDER EITHER OR BOTH THIS LICENSE
AND THE LEGAL TERMS APPLICABLE TO ANY SEPARATE FILES, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGES.

80560NT11584A Rev. 3.1                    Page 3 of 69                                2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

APPLICABILITY TABLE

                                       PRODUCT

                                  GS2K based Modules

                                      SW Version

                                      5.1.X onwards

Note: The features described in the present document are provided by the products equipped
      with the software versions equal or higher than the versions shown in the table. See also
      the Revision History chapter.

80560NT11584A Rev. 3.1                   Page 4 of 69                               2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Revision History

  Version      Date          Remarks

  1.0          Apr 2016      Initial release

  2.0          Sept 2017     Added the following sections:
                             4.3 Process Flow
                             4.5 Task Interface Architecture for Applet–1
                             4.6 Task Interface Architecture for Applet–3
                             5.2.7 Video Rate Adaptation using Remote RTCP Information and
                             Local Data
                             Updated Appendix A Reference Codes

  3.0          Dec 2017      Added section 4.4 Button and its Functionalities

                             Added section A.7 Converting TimberWolf files to C code under
                             Appendix A

                             Added Appendix B Configuring Standby Code in STA Codes

  3.1          Mar 2018      Added Appendix C Configuring VGA support in OV788 Video ADK

80560NT11584A Rev. 3.1                  Page 5 of 69                                  2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Table of Contents
NOTICE……… ........................................................................................................................... 2

COPYRIGHTS. ........................................................................................................................... 2

COMPUTER SOFTWARE COPYRIGHTS ................................................................................. 2

USAGE AND DISCLOSURE RESTRICTIONS .......................................................................... 3

APPLICABILITY TABLE ........................................................................................................... 4

CHAPTER 1. INTRODUCTION .............................................................................................. 10

 1.1. SCOPE ........................................................................................................................ 10
 1.2. OVERVIEW................................................................................................................... 10
 1.3. TERMINOLOGY ............................................................................................................. 11
 1.4. STANDARDS AND CONCEPTS ........................................................................................ 12
CHAPTER 2. FEATURES AND CAPABILITIES .................................................................... 13

CHAPTER 3. THEORY OF OPERATION .............................................................................. 14

CHAPTER 4. ARCHITECTURE ............................................................................................. 15

 4.1. COMPONENT ............................................................................................................... 16
   4.1.1.   Hardware ........................................................................................................ 17
   4.1.2.   Software ......................................................................................................... 18
 4.2. TASKS ......................................................................................................................... 19
 4.3. PROCESS FLOW .......................................................................................................... 20
 4.4. BUTTON AND ITS FUNCTIONALITIES ............................................................................... 21
 4.5. TASK INTERFACE ARCHITECTURE FOR APPLET–1 .......................................................... 23
 4.6. TASK INTERFACE ARCHITECTURE FOR APPLET–3 .......................................................... 27
 4.7. GS-OV INTERFACE ...................................................................................................... 28
   4.7.1.   Load OV Binary .............................................................................................. 28
   4.7.2.   Read OV Video Data ...................................................................................... 29
   4.7.3.   Read OV Audio Data ...................................................................................... 30
   4.7.4.   Write Audio Data ............................................................................................ 31
CHAPTER 5. EMBEDDED APPLICATION EXECUTION SEQUENCE ................................. 32

 5.1. PROGRAM OV BINARY IN GS NODE .............................................................................. 34
   5.1.1.   Method 1: Upload OV Binary to GS Module ................................................... 34
   5.1.2.   Method 2: Load OV Binary into External Flash via S2W ................................ 35
   5.1.3.   Method 3: Load OV Binary Directly to OV Chip via UART Interface ............... 35
 5.2. VIDEO APPLICATION EXECUTION ................................................................................... 37
   5.2.1    GS Boot up ..................................................................................................... 37
   5.2.2.   Load OV from External Flash to OV Chip via SPI........................................... 38
   5.2.3.   Start RTSP Server (and RTP Task) ................................................................ 40
   5.2.4.   RTSP Message Exchanges ............................................................................ 41
   5.2.5.   Start Forward Audio and Video Streaming ..................................................... 46
   5.2.6.   Reverse Audio Streaming ............................................................................... 50
   5.2.7.   Video Rate Adaptation using Remote RTCP Information and Local Data ...... 51
 5.3. CONFIGURATIONS ........................................................................................................ 55
   5.3.1.   Remote Configuration of Video Encoder Settings .......................................... 56
APPENDIX A REFERENCE CODES ...................................................................................... 58

   A.1.1 RTSP SDK REFERENCE CODE FLOW........................................................................... 58
   A.1.2 RTP VIDEO SDK REFERENCE CODE FLOW ................................................................... 58
   A.1.3 RTP AUDIO SDK REFERENCE CODE FLOW................................................................... 58
80560NT11584A Rev. 3.1                                       Page 6 of 69                                                     2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

 A.1.4 REVERSE AUDIO SDK REFERENCE CODE FLOW ........................................................... 59
 A.1.5 VIDEO ENCODER INTERFACE CODE FLOW ..................................................................... 59
 A.1.6 SIF PROTOCOL............................................................................................................ 59
 A.1.7 CONVERTING TIMBERWOLF FILES TO C CODE............................................................... 62
APPENDIX B CONFIGURING STANDBY CODE IN STA MODE .......................................... 63

APPENDIX C CONFIGURING VGA SUPPORT IN OV788 VIDEO ADK................................ 67

80560NT11584A Rev. 3.1                                    Page 7 of 69                                                  2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

List of Figures
Figure 1: Client mode .................................................................................................................... 15

Figure 2: Hardware Components .................................................................................................. 17

Figure 3: Task Interface Architecture ............................................................................................ 19

Figure 4: Process Flow Diagram ................................................................................................... 20

Figure 5: Task Structure – Applet-1 ............................................................................................... 23

Figure 6: Task Architecture for Applet- 3 ....................................................................................... 27

Figure 7: Loading OV Binary ......................................................................................................... 28

Figure 8: Reading OV video DATA ................................................................................................ 29

Figure 9: Reading OV audio DATA ............................................................................................... 30

Figure 10: Firmware uploads Screen ............................................................................................ 34

Figure 11: Serial Port Selection ..................................................................................................... 35

Figure 12: OV Binary in Program mode ........................................................................................ 35

Figure 13: Transfer Window .......................................................................................................... 36

Figure 14: OV Binary Location ...................................................................................................... 36

Figure 15: OV Binary in RUN mode .............................................................................................. 37

Figure 16: GainSpan UART print after GainSpan module restart .................................................. 37

Figure 17: GainSpan UART print after loading boot loader ........................................................... 39

Figure 18: OV UART print after loading firmware .......................................................................... 40

Figure 19: RTSP communication between GainSpan module and smartphone ............................ 42

Figure 20: Sample RTSP packets ................................................................................................. 42

Figure 21: Fields in actual data ..................................................................................................... 47

Figure 22: Fragmentation Unit ....................................................................................................... 48

Figure 23: RTP Packet Header ..................................................................................................... 49

Figure 24: Sample RTP packets.................................................................................................... 50

Figure 25: Sample TEARDOWN message .................................................................................... 50

Figure 26: SPI and Signaling configurations.................................................................................. 55

Figure 27: Header Information....................................................................................................... 60

Figure 28: Payload ........................................................................................................................ 60

Figure 29: Get Data ....................................................................................................................... 60

Figure 30: ACK/NACK Stage......................................................................................................... 61
80560NT11584A Rev. 3.1                         Page 8 of 69                                                           2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

List of Tables
Table 1: Glossary of Terms ........................................................................................................... 11

Table 2: Hardware Components .................................................................................................... 17

Table 3: Software Components ..................................................................................................... 18

Table 4: GS2011M button and related pins ................................................................................... 21

Table 5: Button and its functionalities ............................................................................................ 22

Table 6: Description of fields in RTP packet .................................................................................. 49

Table 7: Profile and its corresponding rates .................................................................................. 51

Table 8: Profile and their Quality ................................................................................................... 53

80560NT11584A Rev. 3.1                                     Page 9 of 69                                                   2018-03-12
GS2K OV720p HD Full Duplex-Audio Video ADK Application Note
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Chapter 1.               Introduction
1.1.       SCOPE
This document provides an overview about the GainSpan GS2000® based HD Full-duplex Audio
Video Application Development Kit (ADK). It describes the software and hardware architecture,
network topology, functional features, API’s, and Application execution sequence of the
Embedded and Mobile applications. The Video ADK provides a complete video reference design
that allows users to stream video and audio data to their iOS or Android based smartphones and
receives audio from smart phone or PC that played it on ADK.

This document assumes that the reader is generally familiar with GainSpan products, Internet
Protocol (IP) networks and the operation of 802.11 wireless devices.

1.2.       OVERVIEW
GainSpan HD Video Full-duplex Audio ADK is a development platform enabling customers to
build Wi-Fi IP video streaming applications with HD video quality. By integrating the major
hardware and software components for Wi-Fi IP camera solution, this reference platform
facilitates fast time to market for customer projects.

Targeted applications for this platform include Wi-Fi IP cloud cameras, baby monitors, toy
cameras, automotive backup/drive recorder cameras, and variety of other systems where
customer would like to add IP video streaming functionality.

          NOTE:

          GainSpan SDK is mandatory for any development on OV720p HD Video Full-
          duplex Audio ADK.

80560NT11584A Rev. 3.1                   Page 10 of 69                             2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

1.3.        TERMINOLOGY
Following table lists the different terminologies used in this document.

                          Table 1: Glossary of Terms

Term         Explanation

ADK          Application Development Kit

AP           Access Point

API          Application Programmer’s Interface

DIN          Data Input

DOUT         Data Output

HD           High Definition

IP           Internet Protocol

OTAFU        Over the Air Firmware Update

RTP          Real time Transport Protocol

RTSP         Real Time Streaming Protocol

SPI          Serial Peripheral Interface

STA          Client Station

TCP          Transmission Control Protocol

UART         Universal Asynchronous Receiver/Transmitter

UDP          User Datagram Protocol

VGA          Video Graphics Array

RTCP         RTP Control Protocol

WPS          Wi-Fi Protected Setup

80560NT11584A Rev. 3.1                       Page 11 of 69                 2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

1.4.        STANDARDS AND CONCEPTS
Standards

Generic:

       None

ADK Specific:

       •    RTP
       •    RTSP
       •    SIF
       •    RTCP

Concepts

OV720p HD Video Full-duplex Audio ADK uses RTP/RTSP streaming mechanism.

80560NT11584A Rev. 3.1                Page 12 of 69                        2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Chapter 2.               Features and Capabilities
This section provides the features and capabilities of the GainSpan OV720p HD Video Full-duplex
Audio ADK:

Features:

    •   Resolution
            o   Video resolution: 1280*720
            o   Bit rate: 1 Mbps
            o   Frame rate: 30 fps
    •   Format: h.264
    •   Audio
            o   Sample rate: 8k
            o   Formats: G711 (Linear PCM)
    •   Provisioning
    •   OTAFU
    •   mDNS/DNS-SD methods
    •   Standby
    •   Wakeup on Wi-Fi
    •   Applet mechanism
    •   Hibernate
Capabilities:

    •   It demonstrates dynamic loading of Video application based on conditions.
    •   It demonstrates saving of network parameters before going into standby and restoring the
        same once GS node comes out of standby thereby removing the need of establishing new
        session across standby.
    •   It demonstrates putting the device in Hibernate mode which is the lowest power
        consumption mode available.
    •   It demonstrates waking up from Wi-Fi beacon being in lowest power consumption mode.
    •   In Hibernate mode it sends video snap shot data to user and waits for few seconds
        (configurable) for user request to stream.
    •   In Hibernate mode, switch to PSPOLL mode while waiting for user request.

80560NT11584A Rev. 3.1                       Page 13 of 69                           2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Chapter 3.               Theory of Operation

The GainSpan OV720p HD Video Full-duplex Audio ADK demonstrates wireless video streaming
using OV788 video encoder chip along with OV9712 camera sensor and two-way audio streaming
using Microsemi L38051. It uses RTSP for control path and RTP for video & audio data. For
reverse audio, GS module acts as a client, establishes UDP connection with smartphone as a
server and receives the data.

When the HD Video ADK board is powered ON, it comes up as Limited AP Comes in Limited AP
and ready for verified provisioning and starts the RTSP server and RTP tasks. It cannot stream
once provision starts RTSP Server. The smartphone/laptop connects to GS module as STA.
When VLC is launched, it acts as an RTSP client and starts streaming and h.264 data in RTP
packets is received. When a network stream is opened, the URL that needs to be entered while
using VLC is rtsp:// /live.h264.

The Video ADK can be operated in any one of the three modes (Use Cases) as mentioned below:
   • Always ON: This mode is used when there is line power supply available.
   • Wake on wireless (Deep Sleep/Standby): Based on beacon interval it will be on Deep
       sleep or in Standby mode.
   • Event based Wakeup (Alarm): The module will wake up based on event otherwise it’ll be
       on hibernate mode.
The mode type can be selected while building the binary from the SDK Builder.

80560NT11584A Rev. 3.1                   Page 14 of 69                             2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Chapter 4.               Architecture
The Video Low Power ADK architecture consists of GS node working in limited AP/STA mode.
Limited-AP mode is used only for provisioning the module. It is in STA mode that GS node
showcases low power functionality.

The GainSpan Video LP works in two Low Power modes:

   ➢ PSPOLL

   ➢ HIBERNATE

PSPOLL Mode

                                   Figure 1: Client mode

On wake up from standby, Base code loads into RAM check for any Data request packet
notification from Access Point. If there is no packet it goes to standby and wakes up every DTIM
interval. This cycle repeats.

 Once mobile application opens on smart phone or Open VLC player and request for video using
RTSP URL it sends mdns/rtsp packet to find Video service in LAN.GS Video module gets
notification through mdns/rtsp packet and starts the RTSP Server and waits for PLAY request.
The video mobile application uses the discovery feature provided by the video embedded
firmware application to enable automatic discovery of the available video profiles and services.

 Client launches the video application to initiate RTSP communication and acts as an RTSP client
in this process. It fetches h.264 video and G711 audio data from OV chip through SPI interface,
fragments and formats both video and audio data, and sends it over RTP/UDP. In reverse audio,
the audio data is received from the smartphone and is sent to Micro semi decoder through ov788
chip.

Hibernate mode:

In Hibernate mode, GS node wakeup on Button Press notification and sends video snap shot data
to pre-configured Server. After snap shot it starts RTSP Server application and waits for PLAY
request. On smart phone open GS Video app discovery video services that launches RTSP client
and request for data.

80560NT11584A Rev. 3.1                   Page 15 of 69                               2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.1. COMPONENT
The HD Video Full-Duplex Audio ADK components consist of:

       •   External flash (where OV image is optionally stored)
       •   GS Wi-Fi module and embedded application
       •   OV788 video encoder and its firmware
       •   OV9712 digital camera sensor
       •   ZL38051 audio encoder and decoder
       •   LEDs indicators
       •   Native application
The video application board supports the Wi-Fi HD video streaming capability of the GainSpan
module which,

   1. Has a GS Wi-Fi module and embedded application package to support its prescribed set
      of features and functionalities.
   2. Connects to the OV788 chip through SPI serial interface which fetches data from Camera
      sensor OV 9712.
   3. OV788 chip has also interface with Microsemi’s ZL38051 audio processor which does
      both audio encoding and decoding.
   4. Has an external serial flash to store the OV binaries.
   5. Has various LED indicators for indicating,
           o   AP mode: GPIO 31 glows Red
           o   Client mode: GPIO 30 glows Red
           o   OV power on: GPIO 29 glows Green
Native Application

GainSpan native app on Android is used as an application for video and two-way audio streaming.

80560NT11584A Rev. 3.1                    Page 16 of 69                              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.1.1. Hardware
The GainSpan HD Video Full-duplex Audio ADK uses GS2011M Wi-Fi module based video
application board that consists of the following hardware components.

                             Figure 2: Hardware Components

                             Table 2: Hardware Components

Component                       Description

GainSpan Wi-Fi Module           GS2011M module streams video data over Wi-Fi.

Omnivision OV788                Omnivision H.264 video compression chip which supports up to 30
                                fps VGA and HD resolution.

Omnivision OV9712 HD Image      Omnivision OV9712 HD image sensor and lens module which
                                supports 1280*720 video resolutions.
Sensor and Lens module

Microsemi ZL38051               Microsemi audio processing chip which supports G711 A/U law
                                with 16k sampling rate.

Serial Flash                    Used for storage of provisioning, custom application web pages,
                                backup firmware, and OV firmware.

LEDs                            Indicates Power On, Operation mode (Limited AP or Client) and
                                Run or Program mode.

USB port                        Used to power the board and upgrade firmware on the Wi-Fi
                                module.

80560NT11584A Rev. 3.1                Page 17 of 69                                 2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.1.2. Software
The GainSpan HD Video Full-Duplex Audio ADK uses the following software components.

                                    Table 3: Software Components

Component                             Description

GS Video Embedded         Firmware    An embedded application that runs on the GainSpan Video
Application                           ADK board which is the source of the video stream and runs
                                      the RTSP server and RTP.

A wrapper application for Android     Discovers and launches appropriate player that is installed on
                                      the system.

Video Mobile Application for          An RTP and RTSP based video player for playing live video
Android Smartphones                   stream.

OV788 firmware binary                 The OV configurations and functionalities come in a packaged
                                      binary with GS SDK/AEK.

            NOTE: OV source can be shared for customization requiring NDA with OV.

80560NT11584A Rev. 3.1                       Page 18 of 69                                    2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.2. TASKS

                               Figure 3: Task Interface Architecture

•   The main task is divided into two sections: Base code and Applet.
•   Base code performs all basic system initialization.
•   Applet performs the following tasks:
         o Network initialization.
         o Start Video encoder thread.
         o Register for call backs and encoder events.
         o Start RTSP thread and register call back for RTSP events.
         o Start thread for video and audio streaming
•   SPI configurations are configured with GS node as SPI master and OV788 as SPI slave.
•   GS SPI is configured as SPI Master, Mode 1, and DMA mode.
•   OV binary is loaded from GS flash to OV chip.
•   RTSP server is created in RTSP task and poll for events DESCRIBE, SETUP, OPTIONS,
    PLAY and TEARDOWN.
•   As soon as PLAY command is received, RTP task is executed and starts requesting for video
    and audio data from OV on SPI.
•   RTSP Client task establishes the UDP connection with the server waits for the data and if data
    is received, it decodes and plays the audio.
•   RTSP task can receive TEARDOWN (ASYNC) event anytime while video streaming is going
    on in RTP task. If the TEARDOWN receives all the three tasks (forward audio, video, and
    reverse audio) get close.

80560NT11584A Rev. 3.1                    Page 19 of 69                                2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.3. PROCESS FLOW

                           Figure 4: Process Flow Diagram

80560NT11584A Rev. 3.1                Page 20 of 69           2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.4. BUTTON AND ITS FUNCTIONALITIES
The following table details the button functionality with respect to the pin used:

                             Table 4: GS2011M button and related pins

Button                        Pin Name                       Description

Reset Button                  EXT_RESETn or                  This button resets the core CPU domain in
                                                             GS2011M modules. It remains unused
                              EXT_RESET#                     during standby or hibernate mode.

WPS/Snapshot Button           RTC_IO_2                       This pin is tied to the IO in the RTC domain
                                                             and can be used to wake up the system
                                                             from standby or hibernate mode. It is
                                                             available always.

Restore Button                GPIO21                         This is a GPIO in the core domain which is
                                                             only available when CPU is running. It is
                                                             used by the BOOTROM for the Firmware
                                                             Restore Functionality. When the BOOTROM
                                                             is executing the pin is checked in.
                                                             Otherwise, pushing this pin has no effect.

                                                             During normal resets, the pin is likely to
                                                             cause undesirable effects. Therefore, it is
                                                             highly recommended not to overload this
                                                             GPIO. However, due to limited availability
                                                             of GPIOs on our ADK Hardware, we are
                                                             overloading it in RUN mode after the initial
                                                             boot.

80560NT11584A Rev. 3.1                       Page 21 of 69                                     2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

The buttons and their functionalities are explained in the following table:
                                Table 5: Button and its functionalities

                                         Functionality Description
       Button                                                                          Remarks
                         5.3.0 (Video)                5.5.0 Low Power (Video)

Provisioning OTAFU       In AP mode, always ON        Push the WPS snapshot
Button                   and available all the        button for 5 secs to
                         times.                       toggle between
                                                                                          NA
                                                      RUN(Station) mode and
                                                      provisioning/OTA-FU(AP)
                                                      mode.

Reset Button             Push the reset button.       Push the WPS/Snapshot     In case of always ON,
                                                      button followed by the    the push of
                                                      RESET button.             WPS/Snapshot button
                                                                                is optional.

Factory default          Push the WPS/Snapshot        Push the WPS/Snapshot     Note: The dynamic file
Button                   button.                      button for 10 sec.        system is erased to
                                                                                restore the board to
                                                                                factory default settings.

Firmware Restore         Push the restore button      Push the WPS/Snapshot     In case of always ON,
Button                   along with the reset         button followed by        the push of
                         button.                      restore plus the reset    WPS/Snapshot button
                                                      button.                   is optional.

80560NT11584A Rev. 3.1                          Page 22 of 69                                  2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.5. TASK INTERFACE ARCHITECTURE FOR APPLET–1

                           Figure 5: Task Structure – Applet-1

80560NT11584A Rev. 3.1                Page 23 of 69              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

The above Use Cases are explained as follows:

Use Case 1: Always ON (Line powered supply)

This mode is used when there is line power supply available. The module is always ready to take
a client request and comes up instantly. It loads the OV binary, starts RTSP server and waits for
the user request.

After teardown, it remains active searching for a new user request.

Use Case 2: Wake ON Wireless

This mode operates on battery. The module goes to Deep Sleep or Standby mode depending
upon the following settings:

   •   Standby mode - Delay of greater than 500ms
   •   Deep Sleep mode - Delay of less than 500ms
In Wake on Wireless mode, on the first boot up, the module waits for 15 secs (configurable) for a
user request and then goes to Deep Sleep/Standby mode depending on the beacon interval
selected.

On teardown, it immediately goes back to Deep Sleep without any delay.

Functionality:

This mode is also known as ‘PS POLL Applet mode’ where GS node will be constantly in low
power associated state waiting for Asynchronous events from the network. Low Power is achieved
by going into standby between the configured beacon interval. The beacon interval is
customizable and has a default wakeup on five beacons. The GS node wakes up just after five
beacons. Only unicast data will be buffered on the AP side which will be received by GS node
after five beacons by using the PS poll mechanism. Note that if any broadcast data comes during
this time, it will be missed.

Operation:

   •   Initializes clock and gets boot reason.
   •   Initializes basic hardware, soft timer, GPIO, alarm, UART, and persistent timer.
   •   Initializes the file system, loads default configuration from flash file system, initialize OV
       and start RTSP server along with PLAY request timeout timer, if it is first time boot.
   •   On expiry of PLAY request timer or Receive TEARDOWN, GS node goes back to standby.
   •   After Wakeup from standby, it initializes the lower system modules such as exception
       handler, HI layer, and sys ctl.
   •   Releases the reset of the WLAN and sends boot-up request informing WLAN that the APP
       CPU is operating in PS POLL Applet Mode.
   •   Registers for various events such as DAB Ready (Data After Beacon), DAB Done with
       Wireless Device Driver (WDD).
   •   Indicates WLAN to wake up on configured beacon interval.
   •   The WLAN wakes up and checks the boot-up message, in case the App CPU is
       functioning in PS poll Applet Mode, it will load a small footprint binary capable of handling
       only a subset of events (DAB Ready, DAB Done). It will check the beacon for any data
       available and accordingly send the event to the APP CPU.
   •   APP CPU will take the following action:
   If data is present:

   •   It receives an DabReady event from WLAN CPU.
80560NT11584A Rev. 3.1                     Page 24 of 69                                  2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

   •   It will load the Applet code dynamically which does the full initialization of the system,
       starts NCM, initializes the network interface, and is ready to receive data packets.
   • It calls and sends an Interface Resume event to WLAN.
   • If the data packet is a RTSP or mDNS packet, it loads the OV and start RTSP Server.
   • The RTSP Server waits for PLAY request from client.
   • In case, if APP CPU receives TEARDOWN after play or if no request is received within 30
       seconds (configurable time) it will stop NCM, save the parameters in RTC, and put the
       system in standby.
   If data is not present:

   •   APP CPU receives an DabDone event from WLAN CPU.
   •   APP CPU on receiving this event will put the system into standby.

Use Case 3: Event based wakeup (Alarm)
In this Use Case, the module goes on hibernate mode if no request is received.

Functionality:

On first boot, the module loads everything and waits for 15 secs (configurable time) for a user
request. If no request is received, after loading the OV binary, it goes to Standby/ Deep Sleep
mode based on the beacon configuration for the next 30 secs and still waits for a user request.

After these 30 secs are completed, it goes into hibernate mode. The Switch SW3 (snapshot/WPS
button) is configured as an alarm trigger before it goes to hibernate.

When SW3 is pressed, it wakes up and goes to Deep Sleep/Standby based on beacon
configuration for 30 secs. In case, if the user starts streaming, it loads the OV binary and starts
streaming. Once the stream is stopped, it immediately goes back to hibernate mode without a
delay.

Operation:

If macro APP_HIBERNATE_ENABLE is enabled, GS node works in Hibernate mode. ‘Basic code’
also called as base application is started which performs the following:

   •   Initializes clock and receives boot reason.
   •   Initializes basic hardware, soft timer, GPIO, alarm, and UART.
   •   Initializes file system and loads default configuration from flash file system, initialize OV
       and start RTSP server along with PLAY request timeout timer, if it is first time boot.
   •   On expire of PLAY request timer or receive teardown, GS node goes back to hibernate
       mode.
   •   If wakeup is from hibernate boot, it restores the hibernate data from LATCH RAM.
   •   Powers up the WLAN Core.
   •   Initializes the lower system modules such as exception handler, HI layer, sys ctl, and
       configures the clock source.
   •   Posts a message to the Applet loader thread to load Applet.

Applet is dynamically loaded by the Video LP base application which performs the following:

   •   Releases WLAN reset so that it gets initiated.
   •   Initializes the supplicant and random number generator.
   •   Initializes the remaining system (wdd msg handler, network stack, BSD, SM, and NCM).

80560NT11584A Rev. 3.1                     Page 25 of 69                                 2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

   •   Initializes the interface, BSD, state machine (SM), and Network Connection Manager
       (NCM).
   •   Starts NCM to connect to the predefined SSID. If Hibernate mode, then it will take the
       scan entries and goes ahead with the Association. Also, it will be a lean DHCP where it
       will request for the last saved IP address.
   •   Power saving is achieved by switching to PSPOLL mode/Deep Sleep mode in
       WAITING_PERIOD. In case if play request is received, it loads OV and starts RTSP
       Server stream Video data to client.
   •   On timer expire or receiving teardown goes to hibernate mode.
   •   Saves the scan entry, IP address, PSK in RTC latch memory and goes to hibernate mode
       and is awakens only by the RTC alarm pins.

80560NT11584A Rev. 3.1                  Page 26 of 69                              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.6. TASK INTERFACE ARCHITECTURE FOR APPLET–3
The Applet-3 is for verified provisioning. The process is as described below:

                                           Entry Function
                                       Applet 3 – Thread Entry
                            {
                            Initiate system (File System, Wi-Fi, HI
                            supplicant)
                            Give Boot reverse to WLAN
                            Initialize N/W stack, BSD layer, SM
                            Initiate NCM and start NCM
                            Event handling loop
                            {
                                 Wait ON message
                                 Process message
                            }
                            Starts concurrent mode
                            Handles provisioning events
                            Connect to Access Points, if credentials are
                            correct else stay in Limited AP
                            }

                               Figure 6: Task Architecture for Applet- 3

80560NT11584A Rev. 3.1                     Page 27 of 69                        2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.7. GS-OV INTERFACE
4.7.1. Load OV Binary

                             Figure 7: Loading OV Binary

       •   The OV binary is programmed in external flash*.
       •   On boot up, after GS initialization, the OV binary is loaded into OV chip.
       •   The OV binary has the default decoder configurations for fetching OV video.
       •   OV Binary is loaded in two parts:
           o First OV bootloader gets loaded with clock configuration 10 MHz
           o Followed by Slave binary which is loaded and remains the same for data transfer.

80560NT11584A Rev. 3.1                   Page 28 of 69                              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.7.2. Read OV Video Data

                               Figure 8: Reading OV video DATA

       •   After GS node initialization and network initialization, the main task creates RTSP and
           RTP video tasks.
       •   Once RTSP task receives PLAY event, RTSP server state is set from idle to running
           state.
       •   RTP waits until the server status goes to running and initiates the video and audio
           streaming.
       •   Video streaming:
           o Start video encoder.
           o Get video data length from the encoder.
           o Check for the frame size. It should not be more than 65KB.
           o Get video data from OV chip:
                  ▪ Make GPIO A* high.
                  ▪ Wait for GPIO B* high.
                  ▪ Enable the SPI0 CS.
                  ▪ Read data.
                  ▪ Disable the SPI0 CS.
                  ▪ Make GPIO A* low and wait for GPIO B* to be low.
           o Stop video encoder.

80560NT11584A Rev. 3.1                    Page 29 of 69                                2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.7.3. Read OV Audio Data

                              Figure 9: Reading OV audio DATA

       •   Along with the main task, RTSP, and RTP video tasks, creates RTP audio task.
       •   Once RTSP task receives PLAY event, RTSP server state is set from idle to running
           state.
       •   RTP waits until the server status goes to running and initiates the audio streaming.
       •   Audio streaming:
           o Start audio encoder.
           o Get audio data length from the encoder.
           o Check for the frame size. It should not be more than 65KB.
           o Get audio data from OV chip:
                  ▪ Make GPIO A* high.
                  ▪ Wait for GPIO B* high.
                  ▪ Enable the SPI0 CS.
                  ▪ Read data.
                  ▪ Disable the SPI0 CS.
                  ▪ Make GPIO A* low and wait for GPIO B* to be low.
           o Stop audio encoder

80560NT11584A Rev. 3.1                   Page 30 of 69                              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

4.7.4. Write Audio Data

       •   Along with the RTP video and audio tasks, creates RTSP client task.
       •   It creates UDP socket and listens on audio port.
       •   When the user selects the call option from the native app, GS module receives the
           audio data and decodes the received data using g711 decoder.
       •   Sends data to OV:
           o Start audio decoder.
           o Send audio data length to the OV.
           o Send audio data to OV chip:
                    ▪ Make GPIO A* high.
                    ▪ Wait for GPIO B* high.
                    ▪ Enable the SPI0 CS.
                    ▪ Write data.
                    ▪ Disable the SPI0 CS.
                    ▪ Make GPIO A* low and wait for GPIO B* to be low.
           o Stop audio decoder.

           NOTE:

           GPIO A, GPIO B and other GPIO configurations are explained in section 5.3
           Configurations.

80560NT11584A Rev. 3.1                  Page 31 of 69                             2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Chapter 5.               Embedded Application Execution Sequence
The Video Low power application by default comes in PSPOLL mode. The PSPOLL boot
sequence is as follows:

   1. Program OV binary in GS
       a) Upload OV binary to GS Module
   2. Video application execution
       a) After GS first Boot up
       b) Video_lp binary checks for Boot type as PSPOLL or Hibernate
            1. If PSPOLL Boot, restore the standby data and check DAB Ready indication.
            2. If DAB Ready indication notified loads applet (applet_1.bin) otherwise, goes to
                standby
   After applet loads and do default configuration initialization. The sequence is as follows:

       c) Load OV from GS flash via SPI at 10MHz
               a. Load Boot Loader
               b. Load OV binary
       d) Start RTSP Server (and RTP Task) and play time out timer
       e) RTSP Server waits for PLAY method till timer expires. On timer expires it goes to
          standby
       f)   Discover the video service in video application or launch via VLC
       g) RTSP message exchanges
       h) On receive of “PLAY”, sets the server status as running and initiate video and audio
          streaming
       i)   RTSP thread establishes UDP connection, connects to UDP server on the app and
            waits for the data. When the call button is pressed in the native app, UDP server in the
            smartphone sends data and GS module receives the audio stream and plays.
       j)   Terminate streaming (RTSP Server keeps running, TEARDOWN is sent when native
            APP is closed).
       k) On receiving TEARDOWN, it goes back to standby.
   In case Video Low power application compiled with APP_HIBERNATE_ENABLE flag
   application boot up in Hibernate mode. Sequence of Hibernate is as follows:

   1. Program OV binary in GS
       a) Upload OV binary to GS Module
   2. Video application execution
       a) GS node wakeup by pressing Alarm 3 button. On wakeup Video_lp binary loads into
          RAM.
       b) Video_lp binary checks for Boot type. As code compile with
          APP_HIBERNATE_ENABLE it boots up in Hibernate mode and Boot type set to
          HIBERNATE.
            1. Video_lp binary restore the Hibernate data.
            2. Loads applet (applet_1.bin).
    After applet loads and do default configuration initialization. The sequence is as follows:

80560NT11584A Rev. 3.1                      Page 32 of 69                                 2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

        a) After NCM starts, loads OV binary.
        b) After send data waits for user response If user request to stream.
        c) Start RTSP Server (and RTP Task).
        d) Discover the Video service in Video Application or launch via VLC
        e) RTSP message exchanges
        f)   On receive of “PLAY”, sets the server status as running and initiate video and audio
             streaming.
        g) RTSP thread establishes UDP connection, connects to UDP server on the app and
           waits for the data. When the call button is pressed in the native app, UDP server in
           the smartphone sends data and GS module receives the audio stream and plays.
        h) Terminate streaming (RTSP Server keeps running, TEARDOWN is sent when native
           APP is closed).
        i)   On receiving TEARDOWN, it goes back to Hibernate.

80560NT11584A Rev. 3.1                     Page 33 of 69                              2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

    5.1. PROGRAM OV BINARY IN GS NODE
The OV binary is loaded into GainSpan module via three methods:

    5.1.1. Method 1: Upload OV Binary to GS Module

Perform the following steps to do an over the air update for OV binary into the external flash of
GainSpan module:

          NOTE: OV binary are provided as part of the release package from GainSpan
          which can be loaded directly via S2W into external flash.

•   Over the air firmware update for OV can be done only after once OV binary with required
    superblocks and control blocks have been programmed in external flash (It comes as a part of
    Quick start guide and can be done via S2w application).
•   OV firmware consists of dsif_sl.bin (slave image) and dsif_bt.bin (bootloader image), which
    are combined to make a 1MB (1024KB) file system for programming into external flash. This
    can be directly programmed to external flash via s2w application.
•   For performing OTAFU for OV image 4KB control block need to be appended at the start of
    image followed by the OV image. The size of image compatible for OTAFU comes to 1028KB.
    The steps and scripts to create the same has been shared at,
       ../SDK/embedded/tools/GS_Extflash_FS_Create_tool folder
    1. Generate the OV binary as explained above and copy into a Laptop or a PC.
    2. Switch on the GainSpan Video ADK board. It comes up in limited AP mode with SSID as
       GS_PROV_VIDEO_XXXXXX, and passphrase is “GS_XXXXXX” where XXXXXX are the
       last six digits of the MAC address of GainSpan module.
    3. Connect the laptop or PC with the GainSpan Video ADK board through Wi-Fi.
    4. Access the GainSpan module URL http://192.168.240.1/extotafu.html from Laptop or PC.
    5. Browse the valid firmware image (ov_av_otafu.bin), and click upload.

                              Figure 10: Firmware uploads Screen

    6. GainSpan module restarts itself.

80560NT11584A Rev. 3.1                    Page 34 of 69                               2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

   5.1.2. Method 2: Load OV Binary into External Flash
          via S2W
The package consists of a single image which is built from OV bootloader, and an OV firmware
image which can be directly loaded to serial flash via S2W. When the module boots up, it loads
the OV binary from serial flash to OV chip.

   5.1.3. Method 3: Load OV Binary Directly to OV Chip
          via UART Interface
   1. Open the Tera Term terminal emulation application. Select the serial port for OV UART
      USB and set the Baud rate to 115200.

                               Figure 11: Serial Port Selection

   2. Press SHIFT+X keys simultaneously and a continuous stream of CCCCCC is displayed.
      This indicates the OV binary is in Program mode.

                            Figure 12: OV Binary in Program mode

   3. From the Tera Term window, select File>Transfer >XMODEM > Send.

80560NT11584A Rev. 3.1                   Page 35 of 69                             2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

                                 Figure 13: Transfer Window

   4. Open the folder where the OV binary is located. Select the ov_boot.bin file. Click Open.

                                Figure 14: OV Binary Location

   5. ov_boot binary starts downloading. Once complete, the Tera Term window displays the
      version information of video ADK/AEK OV binary and automatically places the OV chip in
      Run mode.

80560NT11584A Rev. 3.1                   Page 36 of 69                               2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

                                Figure 15: OV Binary in RUN mode

    5.2. VIDEO APPLICATION EXECUTION
The sequence of execution after the GainSpan module restarts is explained in the following
sections.

5.2.1           GS Boot up
The sequence of execution followed for loading boot loader and OV firmware is as follows:

    1. On boot up, the GS node starts up with system initialization.

                 Figure 16: GainSpan UART print after GainSpan module restart

At this point, the main task completes system initialization.

80560NT11584A Rev. 3.1                       Page 37 of 69                            2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

Code Ref:

AppMainCtx_ThreadEntry()

{

---//All system initializations are done here-

---

}

5.2.2.          Load OV from External Flash to OV Chip via SPI
First boot case applet loads without any notification which starts loading OV from external flash by
calling App_OVInit () that initializes OV.
Code Ref:

AppOV_Init(){

---//All system initializations are done here-

---

AppVideo_OVBootupFirmwareTransfer() // This functions initializes SPI for loading
bootloader and firmware to OV chip.

}

OV Load PSPOLL Boot:

After first boot GS node goes to standby and wakeup, loads the applet by getting notification from
DAB Ready Indication call back. App_NwRecvFilter finds the packet type. If it is mdns or RTSP
packet it pushes OV initialize message to App main Task message queue which is then
processed by AppSm_MsgProcess function.
BOOL

App_NwRecvFilter (GSN_NWIF_CTX_T *pNwIf, UINT32 pktLen,

                     GSN_ETHERNET_FRAME_T *pEthFrame)

{

     --//Check for Packet type and push message to MainTask.

    if((GSN_SYS_IS_PS_BOOT_NORMAL() == TRUE ) && ((dType == APP_RTSP_PKT)

                  || (dType == APP_MDNS_PKT)) && (isOVInitDone == FALSE))

          {

              /*Initialise OV Once data request received */

              AppMainCtx_TaskNotify(APP_EVENT_OV_START, 0);

}

PUBLIC GSN_STATUS

AppSm_MsgProcess (APP_MAIN_CTX_T *pAppCtx, APP_MAINTASK_MSG_T msg )

{
80560NT11584A Rev. 3.1                     Page 38 of 69                                 2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

    case APP_EVENT_OV_START :

    {

         /* Flash OV binary to OV chip*/

         App_OVInit();

        }

        break;

}

GainSpan module performs the following steps to load OV firmware from external flash to OV chip
through SPI interface:

GainSpan module checks the actual length of the boot loader and provides the clock with speed
of 10MHz.

            NOTE: GainSpan SPI interface is the master and OV chip is the SPI slave.

GainSpan module sends the boot configuration parameters to the video chip. Boot configuration
parameters contain 16 bytes of data which provides the actual length of the boot loader and other
information such as basic configurations. Video chip configures the system configurations
according to the configuration parameter and waits for the boot loader.

GainSpan module waits for 5ms and loads the boot loader into the video chip through SPI
interface at a clock speed of 10 MHz. The GainSpan UART print when the boot loader is loaded
into the video chip is as follows:

                    Figure 17: GainSpan UART print after loading boot loader

Once the boot loader is downloaded into the video chip, the GS module waits for 5ms and
increases the clock speed of SPI interface to 10 MHz.

GainSpan module sends the boot configuration parameters of the OV firmware to the video chip.
Boot configuration parameter contains 16 bytes of data which provides the actual length of the OV
firmware and other information such as basic configurations. Video chip configures the system
configurations according to the configuration parameter and waits for the boot loader.

GainSpan module waits for 25ms and loads the OV788 firmware into the video chip. The OV
UART print when firmware is loaded into the video chip is as follows:

80560NT11584A Rev. 3.1                    Page 39 of 69                               2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

                         Figure 18: OV UART print after loading firmware

 5.2.3. Start RTSP Server (and RTP Task)

   2. At this point of time, OV binary is loaded to the OV chip, and the main task is completed
      by creating RTP and RTSP tasks.

       Code Ref:
       AppRtsp_Init(){

        --- //All system initializations are done here-

        ---

        #ifdef RTSP_SERVER_EN

            //It acts like interface between App and VideoEnc chip

            // that performs start,stop the encoder and do encode audio.video frames

            AppVideoEnc_ThreadStart();

            // Register application call back function to

            // Notifies when encoded frame is Ready

            AppVideoEnc_EventCbReg(AppRemainInit_VideoEncEventNotify);

            //Create RTSP Server socket and handles the RTSP methods

            RTSPThreadStart();

                AppVideoThreadSendStart();

                AppAudioThreadSendStart();

            //Register application call back function to get Notify when

            //event occur in RTSP framework

            GsnRtsp_EventNotifyCbReg(AppVideo_RtspCb);

       #endif

80560NT11584A Rev. 3.1                    Page 40 of 69                             2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

              NOTE:

              •   RTSP_SERVER_EN - Macro to enable the RTSP session

              •   RTSP_AUD_EN - Macro to enable forward Audio

              •   AUDIO_ONLY - Macro to enable audio only session

              •   RTSP_CLIENT_EN - Macro to enable reverse audio

   3. GainSpan module starts the RTSP and RTP services after the boot loader and OV
      firmware are loaded on to the video chip. When RTSP receives the PLAY request, sets
      the status to running. RTP waits until the server state goes to running, reads the video and
      audio data over SPI interface and send the video and audio to the smartphone over the
      air. At the same time RTSP client task establish UDP connection waiting for audio data
      from smart phone. Once the user press call back button on Native app audio data starts
      streaming from smart phone to GS module.

          NOTE: RTSP uses the standard port number 554.

 5.2.4. RTSP Message Exchanges
RTSP task is handled in the function call RTSPThreadStart() and the detailed description is as
follows.

For more details about the code flow, refer section

RTSP SDK Reference Code Flow.

The RTSP communication between GainSpan module and smartphone is as shown in the
following figure.

80560NT11584A Rev. 3.1                     Page 41 of 69                               2018-03-12
GS2K OV720p HD Full Duplex Audio Video ADK Application Note

         Figure 19: RTSP communication between GainSpan module and smartphone

The RTSP server which is part of the embedded firmware supports DESCRIBE SETUP,
OPTIONS, PLAY and TEARDOWN methods. The sample RTSP packets are as shown in the
following figure:

                           Figure 20: Sample RTSP packets

80560NT11584A Rev. 3.1                Page 42 of 69                         2018-03-12
You can also read