gs2k music adk application note€¦ · gs2k music adk application note 80560nt11582a rev. 2.0 page...

46
GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 – 2016-06-01

Upload: others

Post on 19-Jun-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 – 2016-06-01

Page 2: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01

NOTICE

COPYRIGHTS

COMPUTER SOFTWARE COPYRIGHTS

SPECIFICATIONS ARE SUBJECT TO CHANGE WITHOUT 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.

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.

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.

Page 3: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 3 of 46 2017-06-01

USAGE AND DISCLOSURE RESTRICTIONS

I. License Agreements

II. Copyrighted Materials

III. High Risk Materials

IV. Trademarks

V. Third Party Rights

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.

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

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.

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

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.

Page 4: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 4 of 46 2017-06-01

APPLICABILITY TABLE

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 Document History chapter.

PRODUCT

GS 2K based Modules

Page 5: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 5 of 46 2017-06-01

Revision History

Version Date Remarks

1.0 August-2015 Initial release

2.0 June 2016 Updated figures in Chapter 6 Native Application and Execution Sequence

Page 6: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 6 of 46 2017-06-01

Table of Contents

NOTICE………. ............................................................................................................................ 2

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

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

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

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

CHAPTER 1 INTRODUCTION .................................................................................................. 9

1.1 SCOPE .............................................................................................................................9 1.2 OVERVIEW........................................................................................................................9 1.3 TERMINOLOGY ................................................................................................................10 1.4 STANDARDS AND CONCEPTS ...........................................................................................11

CHAPTER 2 FEATURES AND CAPABILITIES ..................................................................... 12

CHAPTER 3 THEORY OF OPERATION ................................................................................ 13

CHAPTER 4 ARCHITECTURE ............................................................................................... 14

4.1 COMPONENTS ................................................................................................................15 4.1.1 Hardware ............................................................................................................ 19 4.1.2 Software ............................................................................................................. 19

4.2 TASKS ............................................................................................................................20 4.3 GS2011MIZ- BF527 INTERFACE (SPI) ...........................................................................22

4.3.1 SPI Protocol for Audio Decoder Communication ............................................... 22 CHAPTER 5 EMBEDDED APPLICATION EXECUTION SEQUENCE ................................. 26

5.1 BOOT UP AND INITIALIZATIONS .........................................................................................26 5.2 DISCOVERY AND PAIRING ................................................................................................28

5.2.1 DMR Discovery by DMC .................................................................................... 28 5.2.2 DMC and DMR pairing ....................................................................................... 29

5.3 FETCHING MUSIC DATA FROM DMS ................................................................................31 5.4 SENDING MUSIC DATA TO AUDIO DECODER ....................................................................34

CHAPTER 6 NATIVE APPLICATION AND EXECUTION SEQUENCE ................................ 36

APPENDIX A FLASHING BLACKFIN BINARY ...................................................................... 41

APPENDIX B REFERENCE CODES ....................................................................................... 43

B.1 GPIO INITIALIZATION CODE ............................................................................................43 B.2 SPI CONFIGURATION CODE ............................................................................................43

APPENDIX C PIN USAGE-GPIOS ........................................................................................... 45

Page 7: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 7 of 46 2017-06-01

List of Figures

Figure 1: DLNA Architecture ...................................................................................................... 11

Figure 2: Music ADK in Limited AP Mode .................................................................................. 14

Figure 3: Music ADK in Client Mode .......................................................................................... 15

Figure 4: Music ADK Component Architecture .......................................................................... 15

Figure 5: Music ADK LEDs ........................................................................................................ 16

Figure 6: Music ADK Board ........................................................................................................ 17

Figure 7: HANGSONG Module .................................................................................................. 17

Figure 8: Music ADK Task Architecture ..................................................................................... 20

Figure 9: GS2011MIZ- BF527 Interface Architecture ................................................................ 22

Figure 10: TLV Message Format ............................................................................................... 23

Figure 11: Flow Diagram for SPI Communication between GS2011M and BF527 .................. 25

Figure 12: Smartphone Network Discovery ............................................................................... 36

Figure 13: Password .................................................................................................................. 37

Figure 14: Smartphone Network Connection ............................................................................. 37

Figure 15: BubbleUPnP APP Launch ........................................................................................ 38

Figure 16: Menu options............................................................................................................. 38

Figure 16: BubbleUPnP DMR Discovery ................................................................................... 39

Figure 18: GS node Renderer .................................................................................................... 39

Figure 18: Music selection.......................................................................................................... 40

Page 8: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 8 of 46 2017-06-01

List of Tables

Table 1: Glossary of Terms ........................................................................................................ 10

Table 2: Hardware Components ................................................................................................ 19

Table 3: Software Components .................................................................................................. 19

Table 4: Music Events/Commands ............................................................................................ 24

Table 5: TLV Protocol GPIOs Description ................................................................................. 24

Page 9: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 9 of 46 2017-06-01

Chapter 1 Introduction

1.1 SCOPE

This document provides detailed information about the GainSpan GS2000® based Music Application Development Kit (ADK) by describing hardware/software architecture, functional features, API’s, application execution sequence of the embedded application.

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

1.2 OVERVIEW

GainSpan Music ADK is a development platform enabling customers to build a Wi-Fi based music streaming applications. It demonstrates streaming of music using DLNA mechanism. Receives music data from mobile application over Wi-Fi and plays it on Lineout channels, after being decoded using an audio decoder.

Targeted applications for this platform include Wi-Fi speakers, sound bars, headphones and other IOT devices.

NOTE:

GainSpan SDK is mandatory for any development on MUSIC ADK.

Page 10: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 10 of 46 2017-06-01

1.3 TERMINOLOGY

Following table lists different terminologies used in this document.

Term Explanation

AP Access Point

API Application Programmer’s Interface

DIN Data Input

DOUT Data Output

IP Internet Protocol

SPI Serial Peripheral Interface

TCP Transmission Control Protocol

UART Universal Asynchronous Receiver/Transmitter

UDP User Datagram Protocol

DLNA Digital Living Network Alliance

DMS DLNA Media Server

DMC DLNA Media Controller

DMR DLNA Media Renderer

UPnP Universal Plug and Play

SSDP Simple Service Discovery Protocol

NCM Network Connection Manager

Table 1: Glossary of Terms

NOTE:

The term ‘Task’ also means thread in this document.

Page 11: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 11 of 46 2017-06-01

1.4 STANDARDS AND CONCEPTS

Standards

Generic

• HTTP

• SPI

Specific

DLNA

Concepts

Music ADK uses DLNA mechanism for streaming music.

Digital Living Network Alliance (DLNA) develops and promotes a set of interoperability guidelines for sharing digital media among multimedia devices. The guidelines incorporate several existing public standards, including Universal Plug and Play (UPnP) for media management and device discovery and control and widely used digital media formats and wired and wireless networking standards.

There are 12 DLNA certified device classes but only three are considered for Music SDK. Following are the device classes used in the Music ADK:

• Digital Media Server (DMS)

Stores content and makes it available to DMRs

• Digital Media Controller (DMC)

Finds content on digital media servers (DMS) and instructs digital media renderers (DMR) to play the content. Content does not stream from or through the DMC

• Digital Media Renderer (DMR)

Plays content as instructed by a digital media controller (DMC), which finds content from a digital media server (DMS)

Figure 1: DLNA Architecture

In Music ADK,

• Music Adk board acts as a DMR and,

• Smartphone (APP) acts as both DMS and DMC

Page 12: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 12 of 46 2017-06-01

Chapter 2 Features and Capabilities

This section provides the features and capabilities GainSpan Music ADK:

Features

• Music Streaming

• Provisioning

o WEB (Using Brower/GS Provisioning Mobile APP)

o WPS

• OTAFU

Capabilities

• DLNA Media Renderer

• JTAG support for debugging

• SPI slave supports up to 10MHz

Page 13: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 13 of 46 2017-06-01

Chapter 3 Theory of Operation

Music ADK demonstrates music streaming on Wi-Fi using DLNA mechanism. Here, GS node runs DLNA stack and comes up as a DLNA Renderer. A smartphone is required which runs Bubble UPnP or any UPnP DLNA supported application (ANDROID) or Sesam Music UPnP DLNA or any UPnP DLNA supported application (iOS) which acts as both DLNA Server and DLNA Controller.

Once Music ADK board is powered ON for the first time, it comes up in AP mode with DLNA Renderer capabilities. GS node starts DLNA threads which help in getting discovered and serving different music stream commands from the mobile application.

Smartphone connects to the Music ADK AP and when the application is launched it discovers DLNA Renderers in the same network. GS node will be displayed in the mobile application and when selected, both will be paired. When any music is selected for playing, a specific command (PLAY) will be sent to GS node and the same will be forwarded to Audio Decoder via SPI. Mobile application which acts as DLNA controller, sends the URI of the music file to the DLNA Server. After receiving this URI, GS node fetches the music file form DMS and sends it to audio decoder for playing. In the same way, all other events/commands (PAUSE/RESUME/STOP/VOLUME CHANGE) will be served.

Page 14: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 14 of 46 2017-06-01

Chapter 4 Architecture

The GainSpan Music ADK architecture consists of GS node working in limited AP/client mode configured as a SPI Slave and connected to BF527 which acts as SPI Master. GS node runs DLNA stack which receives Music data over Wi-Fi and sends it to BF527 (audio decoder) via SPI. This data goes through a DAC before getting played on Lineout.

The GS node works in two modes:

• Limited AP mode

• Client mode

Limited AP Mode

Figure 2: Music ADK in Limited AP Mode

On powering ON the Music ADK board, the GS node comes up as a Limited AP. Users browse through the list of available wireless networks on their smartphones (Wi-Fi STATION) and connect to the Music ADK AP. The DLNA streaming application (Ex: ANDROID APPLICATION Bubble UPnP/ Sesam Music UPnP) on smartphone (connect to Music ADK AP) discovers Music ADK board and connects to it. The music file selected will be sent over Wi-Fi to GS node, which will be played on Line out or speaker connected to Music ADK board.

Page 15: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 15 of 46 2017-06-01

Client Mode

Figure 3: Music ADK in Client Mode

On powering ON the Music ADK board, the GS node comes up as STA and connects to AP. Smartphone user connects to the same AP. The DLNA streaming application (Ex: ANDROID APPLICATION Bubble UPnP/ Sesam Music UPnP) on smartphone discovers Music ADK board and connects to it. The selected music file is sent over Wi-Fi to GS node and played on Line out or speaker connected to Music ADK board.

4.1 COMPONENTS

The following figure shows the components of MUSIC SDK, it consists of,

• Music ADK board

• Embedded application

• Smartphone Mobile applications

Figure 4: Music ADK Component Architecture

Page 16: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 16 of 46 2017-06-01

Music Application Board

The Music application board demonstrates Wi-Fi music streaming capability using GS node. This board has,

1. An Audio Decoder Chip (BF527) which is connected to GS2011M via SPI serial interface

2. 4 LEDs for indicating different states of operation.

• LED1: Will be ON during Music streaming

• LED2: Will be ON when the GS node comes up in CLIENT mode

• LED3: Will be ON when GS node comes up in AP mode

• LED4: Will be blinked when programming GS2011M.

Figure 5: Music ADK LEDs

3. An application header ‘Micro Interface’ for debugging. Refer to MUSIC ADK Schematics_Rev 1.0 for pin description.

4. PROGRAM SELECT jumper for configuring GS node programming baud rate. If it is shorted, then baud rate is set to 921600. If open, then baud rate is set to 115200. By default, this is set to 115200.

5. 8- Channel Lineout. Currently only 2-Channel is used for playing music.

6. PROGRAM SELECT switch to configure the board in either PROGRAM mode or in RUN mode.

7. RESET button.

Page 17: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 17 of 46 2017-06-01

Figure 6: Music ADK Board

Figure 7: HANGSONG Module

Page 18: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 18 of 46 2017-06-01

Embedded Application

The Music embedded application:

• Operates in both Limited AP and Infrastructure client modes

• Acts as a DLNA Renderer by using DLNA stack

• Communicates with Audio Decoder Chip via SPI for playing Music

Mobile Applications

There are standard mobile applications for both iOS and Android, which can be used for Wi-Fi music streaming.

• Bubble UPnP or any UPnP DLNA supported application (Android)

• Sesam Music UPnP DLNA or any UPnP DLNA supported application (iOS)

Mobile applications act as DMS and DMR. It discovers DMRs in the same network by using SSDP discovery messages, exchanges the DLNA renderer capabilities, connects to the DLNA renderer, and then streams Music over Wi-Fi.

Page 19: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 19 of 46 2017-06-01

4.1.1 Hardware

GainSpan Music ADK board consists of following hardware components.

Component Description

GainSpan Wi-Fi Module GS2011M streams Music data over Wi-Fi.

Audio Decoder Chip (BF527) Analog Devices mid-range DSP capable of multi-channel decode

Digital to Analog Converter (AD1933)

24-bit 8-channel DAC by Analog Devices; sampling rates from 8KHz to 192KHz and 110dB dynamic range

LEDs PROGRAM LED, AP mode LED, Client mode LED and Music Stream LED

Table 2: Hardware Components

4.1.2 Software

GainSpan Music ADK uses the following software components.

Component Description

Embedded Firmware Application

An embedded application firmware that runs on the GS node which executes different tasks for demonstrating Music Streaming on Wi-Fi

DLNA Stack (Library) Provides DLNA Renderer capabilities to Music ADK application.

BF527 binary (Flashed, by default)

Runs in BF527 Audio Decoder, reads data from GS node and performs respective action.

Table 3: Software Components

Page 20: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 20 of 46 2017-06-01

4.2 TASKS

The below figure shows the different tasks being executed in Music ADK application. There are three vital threads running in this application.

Figure 8: Music ADK Task Architecture

System Initializations

➢ When Music ADK board is powered ON, AppMainCtx_ThreadEntry() is started.

➢ AppMainCtx_ThreadEntry performs the required GS node initializations and starts NCM.

➢ NCM creates Limited-AP if GS node is configured as an AP or creates STA and connects to standard Access Point if configured as a Station.

➢ If Wi-Fi connection is established successfully, then starts HTTP server.

➢ Initializes GPIO19 and GPIO20, which will be used for communication with Audio decoder chip (BF527)

➢ Configures SPI interface to which Audio decoder chip (BF527) is connected.

DLNA Stack Init

➢ Initializes DLNA stack, which starts Dlna::AudioRenderDevice and Socket::Server threads.

➢ Callbacks are initialized. These callbacks serve all music events from DMR.

➢ Starts DlnaEntry thread, which is like a wrapper for DLNA stack.

➢ Dlna:AudioRenderDevice thread configures GS node as DMR and joins module to a UDP Multicast Group on which it receives SSDP advertise messages. DLNA renderer responds to SSDP discovery messages, and later the DLNA renderer capabilities are exchanged with DMC, and the DLNA application will be connected to DLNA renderer (running on Music ADK board).

➢ DlnaEntry thread,

- Serves callbacks for all music events from DMR

o PLAY

Page 21: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 21 of 46 2017-06-01

o PAUSE

o RESUME

o STOP

o VOLUME CHANGE

o MUSIC_CODEC

o MUSIC_DATA

- Informs all the music events to Audio decoder via SPI

- Sends actual music data to the Audio decoder.

Music Streaming

➢ When smartphone (in the same network as GS node) application discovers DNRs, Dlna:AudioRenderDevice receives the discovery messages (SSDP) and responds to it. And smartphones detect GS node and connect to it.

➢ When any music content on the application is selected for playing, PLAY command is received by Dlna:AudioRenderDevice and respective callback will be triggered.

➢ On getting the callback, DlnaEntry thread will send the command to Audio decoder chip via SPI, which sends the same to DAC and is played on LineOut channels.

➢ In the similar way, other events are processed.

Note: DLNA API is available from the DLNA Library which is implemented in C++. Source code of this Library is not available for Application Developers.

Page 22: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 22 of 46 2017-06-01

4.3 GS2011MIZ- BF527 INTERFACE (SPI)

GS2011M and BF527 (which acts as audio decoder) are connected via SPI. BF527 acts as SPI Master and GS2011M acts as SPI SLAVE. They use 2 GPIOs GPIO19 and GPIO20 for achieving flow control. Here, SPI Master clocks out at 3.3MHz by default and operates in MODE1.

Figure 9: GS2011MIZ- BF527 Interface Architecture

4.3.1 SPI Protocol for Audio Decoder Communication

On Music ADK board, GS2011M and BF527 (Audio Decoder) are connected via SPI.

GS node receives Music data and other commands on Wi-Fi and sends them to BF527 Audio Decoder chip via SPI. Here, GS2011M acts as SPI Slave and BF527 acts as SPI Master.

Following are the SPI configurations used,

SPI MASTER CLOCK: 3.3 MHz (default) SPI MODE: MODE1 GS2011M SPI Slave is configured to support up to 10MHz clock and uses DMA for communication.

A proprietary protocol (on SPI) is implemented to achieve flow control for this communication. Using this protocol, GS2011M sends the commands received from DMC to Audio decoder. It also sends music data to Audio decoder for playing. This protocol is called TLV protocol and is described in detail below.

TLV stands for TYPE, LENGTH and VLAUE. Each command is formulated into a 10 byte packet and is sent to BF527. Where,

TYPE: 1 byte LENGTH: 4 Bytes VALUE: 5 bytes (N/A)

Page 23: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 23 of 46 2017-06-01

Figure 10: TLV Message Format

NOTE:

Currently value field is not being used, it is reserved for future use.

In the TLV packet, ‘LENGTH’ will be,

1 for PLAY, PAUSE, RESUME and STOP commands

Actual volume number for VOLUME CHANGE command

Actual data size received for MUSIC STREAM command

Codec value when sending MUSIC CODEC.

Codecs supported and respective values are as shown below

Codecs Value Description

AUDIO_FORMAT_MP3 2 MP2 audio file format

AUDIO_FORMAT_AAC_LC 128 MPEG-4 AAC LC Audio object type

LC: Low complexity

AUDIO_FORMAT_AC3 256 Audio codec 3 popularly known as Dolby digital. Currently not supported

AUDIO_FORMAT_FLAC 512 Free lossless audio codec

AUDIO_FORMAT_AC3 1024 Audio codec 3 popularly known as Dolby digital. Currently not supported

Page 24: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 24 of 46 2017-06-01

Following table shows available values ‘TYPE’ filed.

TYPE LENGTH VALUE DESCRIPTION

0x01 (PLAY)

1 N/A When GS node receives PLAY command from DMC, it sends the same to BF527

0x02 (PAUSE)

1 N/A When GS node receives PAUSE command from DMC, it sends the same to BF527

0x03 (STOP)

1 N/A When GS node receives STOP command from DMC, it sends the same to BF527

0x01 (RESUME

)

1 N/A When GS node receives RESUME command from DMC, it sends the same to BF527

0x04 (VOLUME CHANGE)

0 to 100 N/A When GS node receives VOLUME CHANGE command from DMC, it sends the same to BF527 along with the volume number.

0x05 (MUSIC CODEC)

2, 128, 256, 512, 1024

N/A Codec information of the Music Stream from DMC. GS node sends codec information to BF527 before sending PLAY and RESUME commands.

0x06 (MUSIC DATA)

Data Size received from

DMS

N/A When GS node receives Music Stream from DMC, it sends this command to BF527 along with the data size. Followed by actual Music Data.

Table 4: Music Events/Commands

Communication Sequence:

The communication is initiated by GS2011M. Whenever GS node receives any CMD from DMC, it requests clock from BF527 (using GPIO19) for sending the CMD.

Two GainSpan GPIOS, GPIO19 and GPIO20 are used for indicating the status of GS2011M and BF527 respectively. GPIO19 is an OUT pin for GS node and GPIO20 is an input pin.

GainSpan GPIO IN/OUT DESCRIPTION

GPIO19 OUT Low-High transition on this will indicate BF527 that GS2011M has some data to send. And BF527 provides 10 bytes clock from reading the TLV message which contains the CMD

GPIO20 IN LOW- BF527 is busy and cannot receive any data.

HIGH- BF527 is ready to receive data.

Table 5: TLV Protocol GPIOs Description

Page 25: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 25 of 46 2017-06-01

Whenever GS node wants to send any data to BF527, first it checks for GPIO20 HIGH. If it is HIGH, then it will make GPIO19 LOW, populate SPI buffers with data, and make GPIO19 HIGH.

As soon as there is a Low-High transition on GPIO19, BF527 gets an interrupt and it provides 10 bytes clock to read the TLV message, which contains the CMD.

o Once the CMD is sent successfully, GS2011M will pull GPIO19 LOW

Figure 11: Flow Diagram for SPI Communication between GS2011M and BF527

SPI SYNC

When the Music ADK board is powered ON, BF527 makes GPIO20 HIGH and waits for GPIO19 interrupt which is triggered on a Low-High transition on GPIO19.

Page 26: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 26 of 46 2017-06-01

Chapter 5 Embedded Application Execution Sequence

This section describes the complete Music ADK application flow in detail along with code snippets and sniffer logs.

For Music ADK, ‘MUSIC_ADK_BLACKFIN_CHIP’ compile time flag is used.

5.1 BOOT UP AND INITIALIZATIONS

When Music ADK board is powered ON, first AppMainCtx_ThreadEntry() (main task) is started by boot rom code.

AppMainCtx_ThreadEntry(), performs all required initializations and waits on an ‘msg queue’ to handle systems events.

1. GS node initializations - Initializes WIF message system - Initializes WIF System Control Message Handler - Initializes Soft Timer - Initializes File system - Sends boot request to WLAN - Initializes Default configuration - Initializes WDD Message Handler - Initializes NW stack - Initializes WPA Supplicant - Checks and waits for first time calibration to complete - Starts NCM (for L2 and L3 connections)

2. Handles System Events

Following list of events are handled

Page 27: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 27 of 46 2017-06-01

3. Establishes Wi-Fi connection by starting NCM. Depending on the Wi-Fi mode either AP or STATION, establishes Wi-Fi connection, and also performs DHCP configurations. AppSm_MsgProcess(APP_MAIN_CTX_T *pAppCtx, APP_MAINTASK_MSG_T msg )

{

…….

…….

…….

switch ( msg.msgId )

{

case APP_EVENT_NW_START_NCM:

App_NcmStart(pAppCtx, &pAppCtx->if0);

break;

case APP_EVENT_NW_CONNECT_DONE:/*GSN_NCM_CTX_L3CONNECTED*/

…….

…….

…….

GsnNwIf_IpConfigGet(&pAppCtx->if0.nwifCtx,&nwParams);

UIntIP = nwParams.ipv4.ipAddr;

AppSm_ConnectSuccessProcess(pAppCtx);

#ifdef MUSIC_ADK_BLACKFIN_CHIP

/* LEDs are defined only for Music ADK board */

if(GSN_LIMITED_AP == pAppCtx-

>config.networkConfig.networkMode)

{

App_LimApLedStatusSet(1); /* set limited AP led high */

}

else

{

App_ClientLedStatusSet(1); /* set client led high */

}

#endif

…….

…….

retCode = GSN_SUCCESS;

break;

…….

…….

…….

}//end AppSm_MsgProcess()

4. If network connections is successful (APP_EVENT_NW_CONNECT_DONE), - Initializes required GPIOs, GPIO19 and GPIO20 - Configures SPI0 which is connected to Audio Decoder Chip.

AppAudioStream_NwConnectionStart(VOID)

{

GsnOsal_SemCreate(&spiSyncsem, 0);

App_GPIO_Init();

AppSpi_BlackfinSpiConf();

}

- Starts HTTP server on port 80 - Initializes callbacks for all MUSIC Events - Initializes DLNA stack (starts Dlna::AudioRenderDevice and Socket::Server

threads) - Starts DlnaEntryThread, this will perform a Multicast join on

239.255.255.250:1900, to receive SSDP messages.

PUBLIC UINT32 App_NetworkServicesStart(APP_MAIN_CTX_T *pAppCtx)

{

…….

…….

/* Start HTTP Server */

App_HttpdStart(pAppCtx);

Page 28: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 28 of 46 2017-06-01

…….

…….

…….

#ifdef MUSIC_ADK_BLACKFIN_CHIP

AppAudioStream_NwConnectionStart();

#endif

…….

…….

/* Initialize the App DLNA interface function callbacks, and then

initialize the DLNA library */

App_DlnaInterface_func_cb_init();

dlnaInit(app_fn_cbs);

#ifdef MUSIC_ADK_VLSI_CHIP

HeapAvailable();

#endif

…….

…….

return GSN_SUCCESS;

}

GS node boots and comes up as an Access Point or associates to any standard access point configured in Station mode, and starts DLNA threads, which will configure GS2011M as DLNA Media Renderer. This summarizes the basic initializations performed and different services started (such as http server, DLNA renderer, SPI interface, and so on) when a Music ADK is powered ON. Next section describes how GS2011M as DMR is discovered by DMC.

5.2 DISCOVERY AND PAIRING

For the demo, the smartphone must be in the same network as GS node. Either it should be connected to same AP to which GS2011M (Station) is connected or it should be connected to GS2011M Limited AP.

Here, the smartphone acts as both DMC and DMS.

When the smartphone application (say BubbleUPnP) is launched, it sends SSDP Discover (Multicast) messages on IP ADDRESS: 239.255.255.250 and port number: 1900. When GS2011M receives these discovery messages, it will respond to DMC and will be discovered and displayed in the APP GUI.

5.2.1 DMR Discovery by DMC

Following figures show SSDP discovery packet from Smartphone (192.168.240.2) on 239.255.255.250. To which GS node (192.168.240.1) responds with 200 OK.

Page 29: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 29 of 46 2017-06-01

5.2.2 DMC and DMR pairing

Once this DMR (GS2011M) is selected on smartphone application, it connects to the HTTP server on GS node and requests for capabilities of DMR by sending a HTTP GET requests to which GS node responds. Here, data exchange is done in XML format.

Page 30: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 30 of 46 2017-06-01

Page 31: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 31 of 46 2017-06-01

5.3 FETCHING MUSIC DATA FROM DMS

Once the Music/song is selected for playing, DMC sends the URL of the actual music file. This URL contains the path of the music file on DMS, followed by ‘PLAY’ command. Then DMR, which is GS2011M sends HTTP GET to DMS on the same URL and receives the music data.

Following sniffer logs explain the same.

DMC POSTs URI of music file

➢ When the song is selected (in Mobile Application) for playing, DMC sends the URI (path in DMS) of the actual music file to GS2011M. GS node responds with 200 OK

Page 32: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 32 of 46 2017-06-01

➢ DMC sends ‘PLAY’ command to DMR after sending the URI. GS node responds with 200 OK along with ‘PLAY’ response.

Page 33: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 33 of 46 2017-06-01

GS node GETs the music data stream from DMS

➢ DMR which is GS node sends a HTTP GET request on the URI POSTED by DMC for fetching the music data stream.

Next section describes how this fetched music stream data is played on Lineout/Speaker.

Page 34: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 34 of 46 2017-06-01

5.4 SENDING MUSIC DATA TO AUDIO DECODER

After receiving the music stream, GS2011M sends it to Audio Decoder (BF527) via SPI. On BF527, the data is copied into a ring buffer. BF527 buffers data till particular threshold is reached, and only then sends the data to DAC. This buffering is done to avoid any glitches in the music played. This is only done when the first ‘PLAY’ command is received or when ‘PLAY’ is received after ‘STOP’ command. So there will be a delay before the Music starts playing.

Whenever GS2011M receives any music events or commands from DMC, the respective callback will be triggered, which is registered by the application.

Example of ‘PLAY’ command

When any song is selected from BubbleUPnP, it sends ‘PLAY’ command to GS2011M which is received by DLNA stack and respective callback will be triggered to send the same to BF527.

Callback: App_DlnaInterface_PLAY()

Here, App_BF527_Command(), sends the ‘PLAY’ command to audio decoder. But before sending the ‘PLAY’ command, it sends the type of ‘MUSIC_CODEC’ type. The SPI communication is described in section ‘SPI Protocol for Audio Decoder Communication’. This way all other commands are processed along with music data.

Page 35: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 35 of 46 2017-06-01

Following are the set of commands used in this demo

In case of ‘MUSIC_DATA’, first the command is sent which is followed by actual music data as shown in the following figure.

Page 36: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 36 of 46 2017-06-01

Chapter 6 Native Application and Execution Sequence

This section describes how Bubble UPnP application works along with Music ADK.

The Android based mobile application is used to stream music from a Smartphone to any remote device with Wi-Fi. When the mobile application is launched, it discovers all the DLNA renderers in the vicinity and populates the dashboard with the list of devices.

Steps to be performed for the demo:

1. When the Music ADK board is powered ON, it comes up in limited AP mode with SSID prefixed with “GS_PROV_MUSIC-” and followed by last 6-digits of MAC address of the GS2011M. Tap on the SSID as shown in the following figure.

Figure 12: Smartphone Network Discovery

Page 37: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 37 of 46 2017-06-01

2. Enter the password (passphrase) which is GS_ followed by last 6-digits of MAC

address of the GS2011M in the Password field as shown in the following figure.

Example: If SSID of the GS node is GS_PROV_MUSIC-219b88, then the password is

GS_219b88

Figure 13: Password

3. Connect the smartphone to Music ADK Access Point.

Figure 14: Smartphone Network Connection

Page 38: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 38 of 46 2017-06-01

4. Launch BubbleUPnP application.

Figure 15: BubbleUPnP APP Launch

5. Tap on the menu options on the right top corner to view the following screen.

Figure 16: Menu options

Page 39: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 39 of 46 2017-06-01

6. Tap on Renderer so that Bubble UPnP starts discovering Renderers in the network.

Figure 17: Bubble UPnP DMR Discovery

7. Available Renderers are displayed as shown in the following figure. Select the GS node Renderer from the list.

Figure 18: GS node Renderer

Page 40: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 40 of 46 2017-06-01

8. When the connection is established, click on Library and select the music to be played. Once a song is selected it is:

- Streamed through Wi-Fi to GS2011M

- Decoded by BF527 (Audio Decoder) and

- Played on Lineout/Speaker

Figure 19: Music selection

Page 41: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 41 of 46 2017-06-01

Appendix A Flashing Blackfin Binary

Steps for flashing Blackfin (BF527) binary are as follows:

1. Install VisualDSP++ 5.0 IDE

- Install VisualDSP++5.0.exe IDE software in the system.

After installing the software, select Maintain this Installation option as shown in the following snapshot.

- Select Apply a downloaded Update radio button, and press Next.

- Select VisualDSP++_5.0_Update10.1.vdu file, press Next, and install the software.

- After installing the software, the evaluation license details are to be entered. The evaluation license number is:

KIT-168-256-854540-76Evaluation license details can be entered at first usage of Analog Devices VisualDSP++ IDE, or, by adding the license in the IDE under

Help -> About VisualDSP++ -> Licenses

Page 42: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 42 of 46 2017-06-01

2. Flash Blackfin Firmware

- Connect ADZS-ICE-100B to the Hansong module JTAG interface, and connect the USB interface of ICE to the computer.

- Power on the Music ADK board - Open VisualDSP++5.0 IDE. - Create a new session in the IDE using the steps mentioned below: - Under Session tab in IDE, select New Session

o Select ADSP-BF527 Processor. Select Next o Select Emulator. Select Next o Select ADSP-BF527 via ICE-100B o Select Finish button

- After new session is created, flash boot image followed by Blackfin firmware needs to be loaded on Hansong module.

- To load the flash boot image: o Select Flash Programmer under Tools tab in the IDE o Under Driver tab

➢ Select the flash boot image file with .dxe extension ➢ Press the Load Driver button ➢ Verify Success message under Message Center dialog box

- To flash the Blackfin firmware: o Select Flash Programmer under Tools tab in the IDE o Under Programming tab

➢ Select Erase affected radio button ➢ Select Binary radio button with 0x0 offset ➢ Select the Blackfin firmware with file extension .ldr and press Program

button ➢ Verify success message under Message Center dialog box

- After loading the flash boot image and Blackfin firmware on Hansong module, restart the Music ADK board.

- Program GS2011M and stream the Music over DLNA.

Page 43: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 43 of 46 2017-06-01

Appendix B Reference Codes

B.1 GPIO INITIALIZATION CODE

App_GPIO_Init(VOID)

{

/*

GPIO19 is configured as OUTPUT to GS2011 module.

GPIO19 is used for ready status of SPI slave.

If GPIO19 is HIGH, then Blackfin SPI Master will provide the

clock.

GPIO20 is configured as INPUT to GS2011 module.

GPIO20 is used check the ready status of Blackfin processor.

GS2011 SPI slave write should be called only if the status of

GPIO20 is

HIGH (which is set by Blackfin firmware).

*/

/* Set GPIO 20 as IN direction */

GsnIoMux_Sel(GPIO20, GSN_IOMUX_GPIO_20_AGPIO_20);

/* Set GPIO19, and all LED's as OUT direction */

GsnIoMux_Sel(GPIO19, GSN_IOMUX_GPIO_19_AGPIO_19);

GsnIoMux_PullDownEnable (GPIO19);

GsnIoMux_Sel(CLIENT_LED_GPIO30, GSN_IOMUX_GPIO_30_AGPIO_30);

GsnIoMux_PullDownEnable (CLIENT_LED_GPIO30);

GsnIoMux_Sel(LIM_AP_LED_GPIO31, GSN_IOMUX_GPIO_31_AGPIO_31);

GsnIoMux_PullDownEnable (LIM_AP_LED_GPIO31);

GsnIoMux_Sel(MUSIC_LED_GPIO37, GSN_IOMUX_GPIO_37_AGPIO_37);

GsnIoMux_PullDownEnable (MUSIC_LED_GPIO37);

GsnGpio_Init((1 << GPIO19), ~(1 << GPIO19));

GsnGpio_Init ((1 << GPIO20), (1 << GPIO20));

GsnGpio_Init((1 << CLIENT_LED_GPIO30), ~(1 << CLIENT_LED_GPIO30));

GsnGpio_Init((1 << LIM_AP_LED_GPIO31), ~(1 << LIM_AP_LED_GPIO31));

GsnGpio_Init(MUSIC_LED_GPIO37_BITMAP, ~MUSIC_LED_GPIO37_BITMAP);

GsnGpio_OutIndvidualSet(1 << CLIENT_LED_GPIO30);

GsnGpio_OutIndvidualSet(1 << LIM_AP_LED_GPIO31);

/* LED polarity is different for Stream LED, when compared to

LimitedAP and Client LEDs*/

GsnGpio_OutClear(MUSIC_LED_GPIO37_BITMAP);

}

B.2 SPI CONFIGURATION CODE

AppSpi_BlackfinSpiConf(VOID)

{

GSN_SPI_CONFIG_T spiConfig;

memset(&spiConfig, 0, sizeof(spiConfig));

GsnClkCtl_SysPllEn(GSN_CLK_CTL_PLL_FREQ_120MHZ);

spiConfig.spiMode = GSN_SPI_OPERATION_MODE_SLAVE;

Page 44: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 44 of 46 2017-06-01

spiConfig.spiProtocol = GSN_SPI_PROTOCOL_MOTOROLA;

spiConfig.clockPolarity = GSN_SPI_CLK_POL_INACTIVELOW;

// GSN_SPI_CLK_POL_INACTIVEHIGH.

spiConfig.clockPhase = GSN_SPI_CLK_PHASE_180;

// GSN_SPI_CLK_PHASE_0.

spiConfig.dataWordSize = GSN_SPI_DATAWORDSIZE_8;

spiConfig.SerialclockRate = 0;

spiConfig.clockDivider = 100; // 100 - 500Khz, 50 - 1Mhz.

spiConfig.clockSelect = GSN_SPI_CLK_PLL;

//GSN_SPI_CLK_HSRC;

spiConfig.dmaMode = GSN_SPI_DMA_SET;

//GSN_SPI_DMA_CLEAR;

spiConfig.sodMode = GSN_SPI_SOD_CLEAR;

spiConfig.LoopBack = GSN_SPI_LoopBack_CLEAR;

spiConfig.spiRxBuffer = musicSpiBuffer;

spiConfig.spiRxBuffSize = MUSIC_SPI_BUFF_MAX_SIZE;

spiConfig.idleChar = GSN_SPI_IDLE_CHAR;

spiConfig.byteStuff = 0;

spiHandle_Audio.spi.spiRWArg.tx.funcCB = NULL; // can

assign any function for the callback

spiHandle_Audio.spi.spiRWArg.rx.funcCB = NULL;

spiHandle_Audio.spi.spiRWArg.rx.buffer.pData = NULL;

spiHandle_Audio.spi.spiRWArg.tx.buffer.pData = NULL;

spiHandle_Audio.spi.spiRWArg.tx.buffer.size = 0;

spiHandle_Audio.spi.spiRWArg.rx.buffer.size = 0;

/* SPI0 configuration */

GsnIoMux_Sel(33, GSN_IOMUX_GPIO_33_ASSP0_BI_CS);

GsnIoMux_PullDownEnable (33);

GsnIoMux_Sel(GSN_GPIO_SPI0_DIN, GSN_IOMUX_GPIO_34_ASSP0_DIN);

GsnIoMux_PullDownEnable (GSN_GPIO_SPI0_DIN);

GsnIoMux_Sel(GSN_GPIO_SPI0_CLK, GSN_IOMUX_GPIO_35_ASSP0_CLK);

GsnIoMux_PullDownEnable (GSN_GPIO_SPI0_CLK);

GsnIoMux_Sel(GSN_GPIO_SPI0_DOUT, GSN_IOMUX_GPIO_36_ASSP0_DOUT);

GsnIoMux_PullDownEnable (GSN_GPIO_SPI0_DOUT);

GSN_STATUS status = GsnSpi_Open(&spiHandle_Audio,

GSN_SPI_NUM_MSPI, &spiConfig);

if(GSN_SUCCESS != status)

{

AppDbg_Printf("GsnSpi_Open() in slave mode is failed\r\n");

}

}

Page 45: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS

GS2K Music ADK Application Note

80560NT11582A Rev. 2.0 Page 45 of 46 2017-06-01

Appendix C Pin Usage-GPIOs

Following GPIOs are used in Music ADK.

LED/SWITCH GPIO Description

CLIENT_LED GPIO30 Will be ON when the GS node comes up in CLIENT mode

LIM_AP_LED GPIO31 Will be ON when GS node comes up in AP mode

MUSIC_LED GPIO37 Will be ON during music streaming

PROGRAM/RUN SWITCH

GPIO25 PROGRAM SELECT switch to configure the board in either PROGRAM mode or in RUN mode.

Page 46: GS2K Music ADK Application Note€¦ · GS2K Music ADK Application Note 80560NT11582A Rev. 2.0 Page 2 of 46 2017-06-01 NOTICE COPYRIGHTS COMPUTER SOFTWARE COPYRIGHTS SPECIFICATIONS