WyzBee User Manual Version 1.0

WyzBee User Manual Version 1.0
WyzBee®
User Manual
Version 1.0
Mar 2015
Redpine Signals, Inc. Proprietary and Confidential
WyzBee®
User Manual
Version 1.0
Disclaimer:
The information in this document pertains to Redpine Signals, Inc. products. This
information is provided as a service to our customers, and shall be used for
information purposes only.
Redpine assumes no liabilities or responsibilities for errors or omissions in this
document. This document may be changed at any time at Redpine‟s sole discretion
without any prior notice to anyone. Redpine is not committed to updating this
document in the future.
Copyright © 2015 Redpine Signals, Inc. All rights reserved.
Redpine Signals, Inc. Proprietary and Confidential
Page 2
WyzBee®
User Manual
Version 1.0
About this Document
This document describes general information of WyzBeeTM along with the
board bring up and installation procedure for software tools for
developing applications, including a sample TriLED blinky demo
programmed on Keil IDE platform. This document elaborates all the
features and steps for using the WyzBee platform.
Redpine Signals, Inc. Proprietary and Confidential
Page 3
WyzBee®
User Manual
Version 1.0
Table Of Contents
1 Introduction ...................................................................... 11
1.1
1.2
1.3
1.4
1.5
Kit Contents ........................................................................ 11
Features.............................................................................. 11
Hardware Requirements ..................................................... 12
Software Requirements ...................................................... 12
Quick Start .......................................................................... 12
2 WyzBee Setup .................................................................... 13
2.1
2.2
2.3
2.4
2.5
2.6
Board Setup ........................................................................ 13
WyzBee Board Top View ..................................................... 14
WyzBee Board Bottom View ................................................ 14
WyzBee Board Expansion Headers ...................................... 15
CMSIS-DAP USB Drivers Installation ................................... 16
Windows IDE Installations ................................................. 18
3 Theory of operations.......................................................... 19
3.1
3.2
3.3
Block Diagram..................................................................... 19
Peripheral Mappings ........................................................... 19
Peripheral Details ............................................................... 20
3.3.1
3.3.2
3.3.3
3.3.4
3.3.5
3.3.6
3.3.7
TriLED.........................................................................................20
Buzzer ........................................................................................20
Microphone ..................................................................................20
Temperature and Humidity Sensor ..................................................20
Proximity and Ambient Light Sensor ................................................20
IR Receiver ..................................................................................20
9-axis Motion Sensor.....................................................................21
4 Writing WyzBee programs ................................................. 22
4.1
4.2
Starting a project on Keil .................................................... 22
Configuring WyzBee device on Keil uVision4....................... 23
5 Application Demo............................................................... 27
5.1
5.2
5.3
5.4
Description ......................................................................... 27
Package .............................................................................. 27
Tools Required .................................................................... 27
WyzBee Programming through Keil IDE .............................. 27
6 API Guide .......................................................................... 31
6.1
WiFi Library ........................................................................ 31
6.1.1
6.1.2
6.1.3
6.1.4
6.1.5
6.1.6
6.1.7
6.1.8
6.1.9
6.1.10
6.1.11
Initialization .................................................................................31
Scan ...........................................................................................31
Join ............................................................................................32
Socket Open ................................................................................32
Socket Close ................................................................................33
Socket send data ..........................................................................33
HTTP POST Request .....................................................................34
HTTP GET Request ........................................................................34
Disconnect...................................................................................35
MAC Address .............................................................................35
Get Firmware Version .................................................................35
Redpine Signals, Inc. Proprietary and Confidential
Page 4
WyzBee®
User Manual
Version 1.0
6.2
Bluetooth Library ................................................................ 36
6.2.1
6.2.2
6.2.3
6.2.4
6.2.5
6.2.6
6.2.7
6.2.8
6.2.9
6.2.10
6.2.11
6.2.12
6.2.13
6.2.14
6.2.15
6.2.16
6.2.17
6.2.18
6.2.19
6.2.20
6.2.21
6.2.22
6.2.23
6.2.24
6.2.25
6.2.26
6.2.27
6.2.28
6.2.29
6.2.30
6.2.31
6.2.32
6.2.33
6.2.34
6.2.35
6.3
Initialization .................................................................................36
Set Local Name ............................................................................36
Get Local Name ............................................................................36
Set Local COD ..............................................................................37
Get Local COD ..............................................................................37
Get RSSI .....................................................................................37
Get Link Quality1 ..........................................................................38
Get Local BD Address ....................................................................38
Initialize SPP profile ......................................................................39
Set Device Discovery Mode..........................................................39
Get Device Discovery Mode .........................................................39
Set Connection Mode ..................................................................40
Get Connection Mode .................................................................40
Set Pair Mode ............................................................................41
Get Pair Mode............................................................................41
Remote Name Request ...............................................................41
Remote Name Request Cancel .....................................................42
Inquiry .....................................................................................42
Inquiry Cancel ...........................................................................43
Bond or Create Connection ..........................................................43
Bond Cancel ..............................................................................43
Unbond or Disconnect.................................................................44
Set Pin Type..............................................................................44
Get Pin Type .............................................................................44
Pincode Request Reply ................................................................45
Get Local Device Role .................................................................45
Set Local Device Role .................................................................46
Get Service List .........................................................................46
Search Service ..........................................................................47
SPP Connect..............................................................................47
SPP Disconnect ..........................................................................48
SPP Transfer .............................................................................48
SPP Receive ..............................................................................49
Accept SPP Connection ...............................................................49
Wait for connection completion ....................................................49
Peripheral API .................................................................... 50
6.3.1 GPIO ..........................................................................................50
6.3.1.1 GPIO Get ...............................................................................51
6.3.1.2 GPIO Put................................................................................51
6.3.1.3 GPIO InitIn ............................................................................51
6.3.1.4 GPIO InitOut ..........................................................................51
6.3.1.5 GPIO Initialization ...................................................................51
6.3.2 Timer ..........................................................................................51
6.3.2.1 Timer Configuration Structure ...................................................51
6.3.2.2 Initialization ...........................................................................52
6.3.2.3 Load Time ..............................................................................52
6.3.2.4 Interrupt Callback ...................................................................53
6.3.3 I2C Library ..................................................................................53
6.3.3.1 I2C Configuration Structure ......................................................53
6.3.3.2 Initialization ...........................................................................55
Redpine Signals, Inc. Proprietary and Confidential
Page 5
WyzBee®
User Manual
Version 1.0
6.3.3.3 De Initialization ......................................................................55
6.3.3.4 I2C Write ...............................................................................55
6.3.3.5 I2C Read ...............................................................................55
6.3.3.6 Transmit and Receive Complete ................................................56
6.3.3.7 Transmit Interrupt...................................................................56
6.3.3.8 Receive Interrupt ....................................................................56
6.3.3.9 I2C Interrupt ..........................................................................57
6.3.4 SPI Library ..................................................................................57
6.3.4.1 SPI Configuration structure .......................................................57
6.3.4.2 Initialization ...........................................................................58
6.3.4.3 De Initialization ......................................................................58
6.3.4.4 SPI Send................................................................................59
6.3.4.5 SPI Send/Receive ....................................................................59
6.3.4.6 SPI Receive ............................................................................60
6.3.4.7 Enable Slave Chip ...................................................................60
6.3.4.8 Disable Slave Chip...................................................................60
6.3.4.9 Enable Transmit Interrupt ........................................................60
6.3.4.10 Disable Transmit Interrupt.......................................................61
6.3.4.11 Enable Receive Interrupt .........................................................61
6.3.4.12 Disable receive Interrupt .........................................................61
6.3.4.13 SPI Write ..............................................................................61
6.3.4.14 SPI Read ..............................................................................62
6.3.4.15 Receiver Enable .....................................................................62
6.3.4.16 Transmitter Enable .................................................................62
6.3.4.17 Receiver Disable ....................................................................62
6.3.4.18 Transmitter Disable ................................................................63
6.3.5 UART Library................................................................................63
6.3.5.1 UART Configuration Structure ...................................................63
6.3.5.2 Initialization ...........................................................................64
6.3.5.3 De Initialization ......................................................................65
6.3.5.4 Send .....................................................................................65
6.3.5.5 Receive .................................................................................65
6.3.5.6 Send String ............................................................................65
6.3.5.7 Receive String ........................................................................66
6.3.5.8 Transmit Channel Enable ..........................................................66
6.3.5.9 Transmit Channel Disable .........................................................66
6.3.5.10 Receive Channel Enable ..........................................................66
6.3.5.11 Receive Channel Disable .........................................................67
6.3.5.12 Write ....................................................................................67
6.3.5.13 Read ....................................................................................67
6.3.5.14 Receive Interrupt Enable .........................................................67
6.3.5.15 Receive Interrupt Disable ........................................................68
6.3.5.16 Transmit Interrupt Enable .......................................................68
6.3.5.17 Transmit Interrupt Disable.......................................................68
6.3.6 ADC ............................................................................................69
6.3.6.1 ADC Configuration Structure .....................................................69
6.3.6.2 Initialization ...........................................................................71
6.3.6.3 De-Initialization ......................................................................71
6.3.6.4 Trigger the ADC ......................................................................72
6.3.6.5 ADC Readiness .......................................................................72
6.3.6.6 Stop ADC ...............................................................................72
6.3.6.7 Conversion Status ...................................................................72
Redpine Signals, Inc. Proprietary and Confidential
Page 6
WyzBee®
User Manual
Version 1.0
6.3.6.8 Read .....................................................................................73
6.3.6.9 Data Valid ..............................................................................73
6.3.6.10 ADC Enable ...........................................................................73
6.3.7 PWM ...........................................................................................73
6.3.7.1 PWM Configuration Structure ....................................................74
6.3.7.2 Initializing PWM Timer .............................................................75
6.3.7.3 PWM Timer Callback ................................................................75
6.3.7.4 PWM Base Select.....................................................................75
6.3.7.5 PWM Pin ................................................................................76
6.3.7.6 Configuring PWM frequency ......................................................76
6.3.7.7 PWM Start ..............................................................................77
6.3.7.8 Trigger by software .................................................................77
6.3.7.9 Disable PWM Timer Interrupt ....................................................77
6.3.8 Watchdog ....................................................................................77
6.3.8.1 Initialization ...........................................................................78
6.3.8.2 De-Initialization ......................................................................78
6.3.8.3 Call Function ..........................................................................79
6.3.8.4 Interrupt Callback ...................................................................79
6.3.8.5 Stop WDT ..............................................................................79
6.3.8.6 Write Load Value .....................................................................79
6.3.8.7 Read Value .............................................................................80
6.3.9 Systicks ......................................................................................80
6.3.9.1 Initialization ...........................................................................80
6.3.9.2 Delay ....................................................................................80
6.3.10
External Interrupts .....................................................................80
6.3.10.1 External Interrupt Configuration structure .................................80
6.3.10.2 Non-Maskable Interrupt(NMI) Configuration Structure .................81
6.3.10.3 Initialization ..........................................................................81
6.3.10.4 De-Initialization .....................................................................82
6.3.10.5 Channel Enable ......................................................................82
6.3.10.6 Channel Disable .....................................................................82
6.3.10.7 NMI Initialization ....................................................................82
6.3.10.8 NMI De-Initialization ...............................................................83
6.4
External Peripheral API ...................................................... 83
6.4.1 TriLED.........................................................................................83
6.4.1.1 Initialization ...........................................................................83
6.4.1.2 Red ON/OFF ...........................................................................83
6.4.1.3 Green ON/OFF ........................................................................84
6.4.1.4 Blue ON/OFF ..........................................................................84
6.4.2 OLED Display ...............................................................................85
6.4.2.1 Enable Chip Select...................................................................85
6.4.2.2 Disable Chip Select ..................................................................85
6.4.2.3 Transfer Write as single character not as data .............................85
6.4.2.4 Begin ....................................................................................86
6.4.2.5 End .......................................................................................86
6.4.2.6 Set Bit Order ..........................................................................86
6.4.2.7 Set Clock Divider ....................................................................86
6.4.2.8 Data Mode .............................................................................87
6.4.3 IR Receiver ..................................................................................87
6.4.3.1 IRrecv ...................................................................................87
6.4.3.2 enableIRin .............................................................................87
6.4.3.3 Resume .................................................................................88
Redpine Signals, Inc. Proprietary and Confidential
Page 7
WyzBee®
User Manual
Version 1.0
6.4.3.4
6.4.3.5
Decode ..................................................................................88
IR Interrupt Handler ................................................................88
7 APPENDIX A...................................................................... 90
Downloading and Installing Keil IDE ............................................. 90
8 APPENDIX B...................................................................... 95
Downloading and Installing CoIDE................................................ 95
9 APPENDIX C .................................................................... 101
Downloading and installing IAR .................................................. 101
10
APPENDIX D .................................................................. 114
11
APPENDIX E .................................................................. 118
12
FAQs .............................................................................. 119
Expansion Header pin mappings on the ARM M4 MCU and RS9113
................................................................................................... 114
WyzBee Board Program/Run Mode Switch ................................. 118
12.1 What is the significance of Program (ON) mode switch? .. 119
12.2 Why my device manager doesn’t show up the Port name
correctly in my Windows8 system? ............................................. 119
12.3 I am using Keil MDK 5.14 for running the Demo application
on my system but I am unable to do that. Why? ......................... 119
Redpine Signals, Inc. Proprietary and Confidential
Page 8
WyzBee®
User Manual
Version 1.0
Table of Figures
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
Figure
1: WyzBee Board Setup ................................................................... 13
2: WyzBee Board Top View .............................................................. 14
3: WyzBee Board Bottom View ........................................................ 14
4: WyzBee Board Expansion Headers .............................................. 15
5: CMSIS-DAP USB Drivers Installation Wizard ............................... 17
6: WyzBee CMSIS-DAP Debug Port Detection in Run Mode .............. 18
7: WyzBee Block Diagram ................................................................ 19
8: Keil IDE Installation Wizard ........................................................ 90
9: Keil IDE Installation Accept Terms .............................................. 91
10: Keil IDE Folder Selection ........................................................... 91
11: Keil IDE Registration ................................................................. 92
12: Keil IDE Installation .................................................................. 92
13: Keil IDE installation complete ................................................... 93
14: Keil IDE install driver ................................................................ 93
15: Keil IDE ULINK driver ................................................................ 94
16: CoIDE Installation Wizard ......................................................... 95
17: CoIDE Installation Path Selection.............................................. 96
18: CoIDE Installation Procedure .................................................... 96
19: WyzBee Board Program/Run Mode Switch .............................. 118
Redpine Signals, Inc. Proprietary and Confidential
Page 9
WyzBee®
User Manual
Version 1.0
Table of Tables
Table 1: Pin details of Header J2 ................................................................ 16
Table 2: Pin details of Header J3 ................................................................ 16
Table 3: Pin details of Peripherals .............................................................. 20
Redpine Signals, Inc. Proprietary and Confidential
Page 10
WyzBee®
User Manual
Version 1.0
1 Introduction
The WyzBeeTM is a sensor application development platform for Internetof-Things (IoT) applications. The platform consists of Redpine Signals
RS9113 Wi-Fi 802.11bgn module, ARM Cortex M4 device, onboard
sensors and CMSIS-DAP debugger chip all within a tiny form factor.
The user can extend the functionality of the platform through expansion
headers. This platform supports open source GCC based IDEs namely
CoIDE and 3rd party commercial IDEs such as IAR and Keil for application
development. The on board CMSIS DAP debugger can be used with a
standard USB cable for downloading and debugging user program without
requiring costly external debuggers like J-Link.
1.1 Kit Contents

A WyzBee board.

A micro-B USB cable.
1.2 Features

Micro-B USB Full Speed Interface
WyzBee has Micro-B USB connectivity option for debugging through
CMSIS-DAP and programming through USB-CDC.

UFL External Antenna Connector
WyzBee has an on board external antenna connector for enhancing
the Wi-Fi connectivity.

Tri color LED
There is one tri color LED provided on board with blue, green and red
LEDs.

Two Push Buttons
Two push buttons are provided in which one is for hardware Reset
and another for providing an External Interrupt.

Microphone
A microphone is provided to capture the voice signal.

Buzzer
A buzzer has been included for generating a user-defined alert sound.

IR Receiver
The IR sensor enables WyzBee to communicate with any Infrared
transmitter devices.

Temperature and humidity sensor
WyzBee can measure the ambient temperature and humidity using
temperature and humidity sensors
Redpine Signals, Inc. Proprietary and Confidential
Page 11
WyzBee®
User Manual
Version 1.0

Proximity Sensor
Proximity sensor on WyzBee can be used for various applications, like
ISM field applications, etc.

9-axis Motion Sensor
Enabled with 3-axis accelerometer, 3-axis gyro sensor and 3-axis
magnetometer, WyzBee broadens its area of applications.

Wireless Fidelity Module
Provided with Redpine RS9113 802.11bgn Wireless module, WyzBee
is able to connect to any wireless devices like, Access points and WiFi Direct devices.

CMSIS-DAP Debug processor
WyzBee comes with an on board CMSIS-DAP debug processor for
downloading and debugging applications , excluding the need for
using an external debugger.
1.3 Hardware Requirements
To use the WyzBee platform, user needs the following hardware:

The WyzBee board.

A PC with a USB port in it for Power, downloading and debugging.
1.4 Software Requirements
To use the WyzBee platform, following software is needed:

A Windows operating system installed in the PC, preferably
Windows7.

The CMSIS-DAP driver provided by Spansion. Refer to the section
2.5.to download and install this driver.

A development environment like Keil uVision, IAR Embedded
Workbench or CooCox CoIDE.
1.5 Quick Start
For a quick start of WyzBee platform following steps should be followed:

Install the CMSIS-DAP driver on the PC. Refer to the section 2.5.

Install an IDE on the PC. Refer Appendix A,B or C.

Plug in the WyzBee board using a micro-B USB cable.

Configure the IDE environment for the WyzBee board.

Run an example project, debug and program.
Redpine Signals, Inc. Proprietary and Confidential
Page 12
WyzBee®
User Manual
Version 1.0
2 WyzBee Setup
Setting up the WyzBee board is easy. Explanations for the board setup
and its components are presented here.
Before you start, make sure you have satisfied the hardware and
software requirements.
2.1 Board Setup
WyzBee is a USB powered device. Shown below is a powered WyzBee
board.
Figure 1: WyzBee Board Setup
Redpine Signals, Inc. Proprietary and Confidential
Page 13
WyzBee®
User Manual
Version 1.0
2.2 WyzBee Board Top View
Figure 2: WyzBee Board Top View
2.3 WyzBee Board Bottom View
Figure 3: WyzBee Board Bottom View
Redpine Signals, Inc. Proprietary and Confidential
Page 14
WyzBee®
User Manual
Version 1.0
2.4 WyzBee Board Expansion Headers
WyzBee board comes with 30 pins expansion header mounted, which can
be used for connecting with other modules such as sensors, digital
peripherals, LCD, etc.
Figure 4: WyzBee Board Expansion Headers
In the following table all the expansion header pins are described with its MCU
multiplexed lines. For more details please refer to APPENDIX D.
Pin Name
Pin Connections
Description
RST0
MCU_RSET_N
RESET Pin for MCU.
P8
TMS
TMS Pin for DAP MCU
P7
TCK
TCK Pin for DAP MCU
P6
TDI
TDI (Data In) Pin for DAP MCU
P5
TDO
TDO(Data Out) Pin for DAP MCU
Redpine Signals, Inc. Proprietary and Confidential
Page 15
WyzBee®
User Manual
Version 1.0
Pin Name
Pin Connections
Description
RST0
RESET_N_DAP
RESET Pin for DAP MCU
P4
GPIO_2
Option for connecting an external peripheral
P3
I2C_SCL
Clock PIN for I2C
P2
I2C_SDA
Data PIN for I2C
P1
I2S_SCK
Clock PIN for I2S
P0
I2S_WS
Table 1: Pin details of Header J2
Pin Name
Pin Connections
Description
P20
UART2_OUT
OUT Pin for UART
P19
UART2_IN
IN Pin for UART
P18
ADC_1
ADC input pin.
P17
GPIO_1
Option for adding external peripheral
P16
SPI2_MOSI
MOSI pin for SPI
P15
SPI2_MISO
MISO pin for SPI
P14
SPI2_CLK
Clock pin for SPI
P13
SPI2_CS
Chip Select pin for SPI
P12
PWM1
Input 1 for PWM
P11
PWM2
Input 2 for PWM
P10
I2S_DIN
Data IN pin for I2S
P9
I2S_DOUT
Data OUT pin for I2S
Table 2: Pin details of Header J3
2.5 CMSIS-DAP USB Drivers Installation
-
Download the complete drivers and tools provided by Spansion
from the following link
-
https://www.spansion.com/Support/microcontrollers/developmente
nvironment/Pages/board-SK-FM4-U120-9B560.aspx

Windows USB drivers that are specific to the WyzBee need to be
installed for the detection of debugging port. Follow the
instructions below to install the Windows USB drivers.

In the downloaded folder browse to /drivers/driverinstaller.exe and
run the application. Click the next prompt.
Redpine Signals, Inc. Proprietary and Confidential
Page 16
WyzBee®
User Manual
Version 1.0
Figure 5: CMSIS-DAP USB Drivers Installation Wizard

During the installation a warning may appear that the publisher
cannot be verified depending on Windows security settings. Select
“Install this driver software anyway.” Two drivers are being
installed, cmsis-dap and usbdirect. The Windows security window
will appear twice, and „Install this driver software anyway‟ will need
to be selected each time.

When installation is complete, click the finish button when
prompted.

Connect USB cable to Debug port as shown in Figure 1 and observe in the
Device Manager under Ports that USB port is detected. In the Figure 6 this
port is detected as CMSIS-DAP Spansion Virtual Communications port.

If the Device Manager does not display the correct ports and displays
under other devices then click the device and update the driver.
Redpine Signals, Inc. Proprietary and Confidential
Page 17
WyzBee®
User Manual
Version 1.0
Figure 6: WyzBee CMSIS-DAP Debug Port Detection in Run Mode
2.6 Windows IDE Installations
WyzBee applications can be developed using various IDEs like CoIDE, Keil
and IAR. User can refer to Appendix A, B or C seeking steps for
downloading and installing these various softwares.
So, at this point we are ready with our setup to enter the arena for some
IoT application developments. In the following section we will be
discussing about a demo application for beginners on WyzBee.
Redpine Signals, Inc. Proprietary and Confidential
Page 18
WyzBee®
User Manual
Version 1.0
3 Theory of operations
This section goes deeper into WyzBee device elaboration and discusses
about its components in detail.
3.1 Block Diagram
Shown in the figure below is the block diagram of WyzBee.
Figure 7: WyzBee Block Diagram
3.2 Peripheral Mappings
This Table illustrates the peripheral‟s mapping on the host MCU. To
access these peripherals and correct pin configurations, this table can be
referred.
Peripheral Name
Pin Connections (MCU)
TriLED: RED/GREEN/BLUE
P42/P43/P44
Redpine Signals, Inc. Proprietary and Confidential
Page 19
WyzBee®
User Manual
Version 1.0
Peripheral Name
Pin Connections (MCU)
Buzzer
P30
Microphone
Reserved
Temperature Sensor
I2C SCL and I2C SDA
Proximity and ambient light sensor
I2C SCL and I2C SDA
IR Receiver
P10
9-axis motion sensor
I2C SCL and I2C SDA
Table 3: Pin details of Peripherals
3.3 Peripheral Details
3.3.1 TriLED
TriLED included on WyzBee can be used for various applications.
There are three LEDs attached to three different pins of the MCU as
follows:
 RED LED -> Pin P42
 GREEN LED -> Pin P43
 BLUE LED -> Pin P44
3.3.2 Buzzer
Buzzer is used to generate a sound alert. It can be programmed by the
user to generate alerts. It is connected to the Pin P30 of the MCU.
3.3.3 Microphone
-Reserved3.3.4 Temperature and Humidity Sensor
WyzBee uses a temperature and humidity sensor provided by Silicon
Labs, with the module number Si7021. It communicates with the MCU
through I2C protocol and acts as a slave. I2C lines are connected to the
pins P07 & P06. The slave address of this sensor is 0x80.
3.3.5 Proximity and Ambient Light Sensor
WyzBee uses a Proximity and Ambient Light sensor provided by Silicon
Labs, with the module number Si1141. It communicates with the MCU
through I2C protocol and acts as a slave. I2C lines are connected to the
pins P07 & P06. The slave address of this sensor is 0x5A.
3.3.6 IR Receiver
WyzBee is capable of communicating with any infrared devices by the
help of its IR sensor. It is connected to the Pin P10 of the MCU.
Redpine Signals, Inc. Proprietary and Confidential
Page 20
WyzBee®
User Manual
Version 1.0
3.3.7 9-axis Motion Sensor
WyzBee incorporates a 9-axis (3-axis accelerometer, 3-axis gyro sensor,
3-axis magnetometer) motion sensor which can be used for myriads of
applications in IoT. It communicates with the MCU through I2C protocol
and acts as a slave. I2C lines are connected to the pins P07 & P06. The
slave address of this sensor is 0x68 for accelerometer + gyro sensor and
0x0C for magnetometer.
Redpine Signals, Inc. Proprietary and Confidential
Page 21
WyzBee®
User Manual
Version 1.0
4 Writing WyzBee programs
For developing an application on WyzBee, user should have the
understanding of any of the development environment software. For
example, creation of a WyzBee project on Keil uVision IDE is discussed in
this section. User can go through its installation steps by referring
APPENDIX A. Here the pre-requisites of a project creation is described.
4.1 Starting a project on Keil
Following are the steps for starting a new project on Keil uVision v4.74,
and configuring the WyzBee device for debugging.
First, open the uVision4 IDE application. Then click on the „New uVision
Project‟ from the „Project‟ dropdown menu. A window appears; select the
location for the project and the filename. Then click on „Save‟.
It saves the name of the project and opens a window for selecting the
device.
Select the device as shown in the figure below.
Redpine Signals, Inc. Proprietary and Confidential
Page 22
WyzBee®
User Manual
Version 1.0
4.2 Configuring WyzBee device on Keil uVision4

The configuration settings are shown in the following figures.

Click on „Options for Target‟ -> Utilities -> Uncheck Use Debug
Driver -> Select CMSIS-DAP Debugger -> Click on Settings.
Redpine Signals, Inc. Proprietary and Confidential
Page 23
WyzBee®
User Manual
Version 1.0

Click on „Add‟ and select the highlighted device name from the list.
Click OK.

After selecting the flash device, select CMSIS-DAP Debugger in
Debug Tab as shown.
Redpine Signals, Inc. Proprietary and Confidential
Page 24
WyzBee®
User Manual
Version 1.0

Click on “Device” tab and make sure all the settings are selected as
shown in the snapshot below.

Click on “Target” tab and make sure all the settings are selected as
shown in the snapshot below.
Redpine Signals, Inc. Proprietary and Confidential
Page 25
WyzBee®
User Manual
Version 1.0

Click on “Output” tab and make sure all the settings are selected
as shown in the snapshot below.

Click on “Linker” tab and make sure all the settings are selected as
shown in the snapshot below.

Now the WyzBee device is configured on the Keil IDE. User can
confirm it by erasing the flash by clicking on „Erase‟ from the „Flash‟
menu. Next section describes the user about an example of LED
blinky project.
Redpine Signals, Inc. Proprietary and Confidential
Page 26
WyzBee®
User Manual
Version 1.0
5 Application Demo
User is provided with a demo project to kick start and understand the
fundamentals of WyzBee board. Here, we are providing a demo project
using the TriLED mounted on the board. It has three LEDs in it viz. Red,
Green and Blue.
5.1 Description
The project is about blinking the LEDs one at a time introducing some
delay between each blink. Then the frequency of the blinking shall
increase as the time passes up to a certain limit and again fall back to the
initial frequency. These LEDs are connected to the GPIO pins of the
microcontroller, so understanding the configuration of these pins to glow
a particular LED would make a better knowledge for the user.
5.2 Package
User can locate the package „TriLED_blink.zip‟, and extract it and open
the uVision4 project. Steps are elaborated in the section 4.4.
5.3 Tools Required
The demo project requires Keil IDE version 4.74.
For this application demo tools are

WyzBeeTM Board

Windows PC with Keil uVision4 IDE installed

Micro-B USB cable (For Connection to Host PC)
5.4 WyzBee Programming through Keil IDE

After installing all the software‟s as explained in the Section 3 and
powering up the WyzBee board, unzip the „TriLED_blink.zip‟ file.
Open the folder and it will show contents as shown in the below
figure:

Extract it. Go to TriLED_blink. Double click on the uVision4 project
file named „TriLED_blink‟, as shown below.
Redpine Signals, Inc. Proprietary and Confidential
Page 27
WyzBee®
User Manual
Version 1.0

It opens the keil IDE project file. Now, open main.c file inside the
App folder from the Project menu, as shown.

main() function controls all the front end functioning of the app. It
initializes the necessary drivers and configures the WyzBee device
for particular functioning. The implementation is shown below.
Redpine Signals, Inc. Proprietary and Confidential
Page 28
WyzBee®
User Manual
Version 1.0

Sys_ticks_init function initializes systick timer for introducing
delays.

WyzBeeGpio_Init function is used to define the direction and give
the value to any GPIO pin. Here we are using this function to
toggle Blue, Green and Red LED by assigning their direction as
GPIO_OUTPUT. The value GPIO_LOW and GPIO_HIGH corresponds
to LED ON and OFF respectively.

Here we are increasing the blinking speed by reducing the delay
values. For a certain range of „cnt‟ variable the speed remains the
same, and increases as the „cnt‟ keeps decrementing.

User can manipulate with these basic functions and play with this
code for better understanding.

After the selection of different options under Configuration setting
in the Keil IDE, as shown in Section 4.2, user need to do Build,
Erase the Flash and Debugging/Run the Program by selecting the
tool bar buttons as shown in the snapshot below.
Redpine Signals, Inc. Proprietary and Confidential
Page 29
WyzBee®
User Manual
Version 1.0

Compile the project by clicking the compilation buttons (Build and
Rebuild) from the tool bar. If project compiles without any errors,
message will be displayed in the Build output Window.

Erase the ARM Cortex M4 Flash before selecting the Debugging
button by selecting FlashErase button from menu bar.

After Erasing the Flash, click “Start Debug” button from the tool
bar. In the Keil IDE debug cursor points to main function in main.c
file as shown in the snapshot below.

Using Stepin (F11), Stepout (F10), Step over (Ctrl+F11), and Run
(Ctrl + F5) options user can debug the whole project.
For more details on how to use the Keil IDE tool user can refer the
document from the following link:
http://www.keil.com/product/brochures/uv4.pdf
Redpine Signals, Inc. Proprietary and Confidential
Page 30
WyzBee®
User Manual
Version 1.0
6 API Guide
This document provides APIs classified into different categories based on
peripheral interface support. The user can use the suitable APIs while
developing his wireless applications. The Wireless module of the WyzBee
board comes with preloaded software supporting wireless, tcp/ip and ssl
features. After developing the application with the appropriate IDE, user
loads the application code into onchip flash of ARM Cortex M4 device for
execution.
6.1 WiFi Library
6.1.1 Initialization
This function initializes the SPI channel between MCU and Wi-Fi module
and executes the basic Wi-Fi module related initialization functions in a
sequence and initializes the global structures with default values.
This function should be called first in the application before calling any
other functions.
int16 WyzBeeWiFi_Init(void)
Parameter Name
Description
[In] none
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.2 Scan
This function scans the Wi-Fi networks in the surroundings.
int18_t WyzBeeWiFi_ScanNetworks (
rsi_scanInfo *p_scan_resp)
Parameter Name
Description
[Out] p_scan_resp
Pointer to the rsi_scaninfo structure ,into
which scan response is copied.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
Redpine Signals, Inc. Proprietary and Confidential
Page 31
WyzBee®
User Manual
Version 1.0
6.1.3 Join
This function is used to connect Wi-Fi module with the external Access
point (AP) .
int16 WyzBeeWiFi_ConnectAccessPoint (int8* ssid,
const int8 *passphrase)
Parameter Name
Description
[In ] ssid
Pointer to the buffer indicating SSID of the
AP(Access point) to connect.
[In] passphrase
pointer to the buffer indicating Password of
AP(Access point) to connect.
p_key = 0, for Open Mode
p_key = “password” for WPA/WPA2/WEP
modes.In WEP mode default index is taken as 0.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.4 Socket Open
This function is used for opening a socket for TCP and UDP connection.
int16
WyzBeeWiFi_SocketOpen
(uint8
mode,
uint8
*p_dest_ipaddr,
uint16
dest_port_nbr
uint16
module_port_nbr )
Parameter Name
Description
[In ] mode
Connection mode
,
0 = TCP
1 = UDP
[In] p_dest_ipaddr
It contains the IP address of the server.
[In] dest_port_nbr
Port number of the server.
[In] module_port_nbr
Port number of the WyzBee.
Redpine Signals, Inc. Proprietary and Confidential
Page 32
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.5 Socket Close
This is used to close any socket opened.
int16
WyzBeeWiFi_SocketClose (uint16
uint16
sock_desc,
dest_port_nbr)
Parameter Name
Description
[In ] sock_desc
socket to be closed
[In] dest_port_nbr
Port number of the server.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.6 Socket send data
This is used to send data to any created socket.
int16 WyzBeeWiFi_SocketSendData(uint16_t sock_fd,
uint8_t
*ptr_tx_buf,
uint16_t
tx_len,
uint8_t
protocol)
Parameter Name
Description
[In ] sock_fd
socket name
[In] ptr_tx_buf
Buffer containing data to be sent.
[In] tx_len
data length.
Redpine Signals, Inc. Proprietary and Confidential
Page 33
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] protocol
Protocol being followed.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.7 HTTP POST Request
This function is used to post data to the web servers in HTTP and HTTPS
modes.
int16 WyzBeeWiFi_HttpPost (int8
*p_http_url,
HttpRequest
*p_http_req)
Parameter Name
Description
[In] p_http_url
Pointer to the buffer indicating url link of the web
server
[In] p_http_req
Pointer to the buffer indicating data to be posted to
the web server .
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.8 HTTP GET Request
This function is used to get data from the web servers in HTTP and HTTPS
modes.
int16
WyzBeeWiFi_HttpGet(int8
*p_http_url,
HttpRequest
int8
*p_http_req,
uint16
*p_resp,
resp_size)
Parameter Name
Description
[In] p_http_url
Pointer to the buffer indicating resource path on
the web server
[In] p_http_req
Pointer to the buffer indicating data to be filled for
GET request.
[In] p_resp
Response from the server
Redpine Signals, Inc. Proprietary and Confidential
Page 34
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] resp_size
Response size
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.9 Disconnect
This function is used to disconnect the Wi-Fi module from the currently
connected Access Point (AP).
int16 WyzBeeWiFidisconnect(void)
Parameter Name
Description
[In] none
return value
0-success
6.1.10 MAC Address
This function is used to get the MAC address of the RS9113 module.
int16 WyzBeeWiFi_macAddress(int8* mac)
Parameter Name
Description
[Out] mac
Get MAC address of the module
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.1.11 Get Firmware Version
This function is used to get the firmware version loaded in the Wi-Fi
module.
int16
WyzBeeWiFi_FirmwareVersion(int8 * fw_ver)
Parameter Name
Description
[Out] fw_ver
Query the Firmware version of the module
Redpine Signals, Inc. Proprietary and Confidential
Page 35
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2 Bluetooth Library
6.2.1 Initialization
This is used to initialize the BT module. This function should be called first
in the application before calling any other functions.
uint16 WyzBee_BT_init (void)
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.2 Set Local Name
This is used to set name to the local device.
uint16 WyzBee_SetLocalName (uint8 *p_name)
Parameter Name
Description
[In] p_name
String containing the name to be set.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.3 Get Local Name
This is used to get the current name of the local device.
uint16 WyzBee_GetLocalName (uint8 *p_name)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 36
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] p_name
String storing the local device name.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.4 Set Local COD
This is used to set Class of Device of the local device.
uint16 WyzBee_SetLocalCOD (uint32
local_cod)
Parameter Name
Description
[In] local_cod
Variable storing the Class of Device.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.5 Get Local COD
This is used to query Class of Device of the local device.
uint16 WyzBee_GetLocalCOD (uint32
*p_local_cod)
Parameter Name
Description
[In] p_local_cod
Stores the Class of Device data.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.6 Get RSSI
This is used to query RSSI(Received Signal Strength Indication) of the
connected remote BT Device.
Redpine Signals, Inc. Proprietary and Confidential
Page 37
WyzBee®
User Manual
Version 1.0
uint16 WyzBee_GetRSSI (uint8
uint8
*p_remote_bdaddr,
*p_rssi)
Parameter Name
Description
[In] p_remote_bdaddr
String storing the BD address of the remote device.
[Out]p_rssi
Array storing the RSSI value.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.7 Get Link Quality1
This is used to query the link quality between the local device and the
connected remote device.
uint16 WyzBee_GetLinkQuality (uint8
uint8
*p_remote_bdaddr,
*p_link_qa)
Parameter Name
Description
[In] p_remote_bdaddr
String storing the BD address of the remote device.
[Out]p_link_qa
Array storing the Link quality value.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
1
This command is not currently supported.
6.2.8 Get Local BD Address
This is used to query the BD address of the local device.
uint16 WyzBee_GetLocalBDAddress (uint8
*p_remote_bdaddr)
Parameter Name
Description
[Out]p_remote_bdaddr
Array storing the local BD address.
Redpine Signals, Inc. Proprietary and Confidential
Page 38
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.9 Initialize SPP profile
This is used to initialize the SPP profile in Bluetooth embedded host stack.
uint16 WyzBee_InitSppProfile (void)
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.10 Set Device Discovery Mode
This is used to set the BT module in any of the three Discovery modes.
We have to use time out for only limited discovering.
uint16 WyzBee_SetDiscoverMode (uint8 mode,
uint32
timeout)
Parameter Name
Description
[In] mode
Mode – To enable/disable discovering
0 – disable discovering
1 – enable discovering
2 – limited discovering.
[In]timeout
Time out value in milli seconds (100 ms to 5000ms)
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.11 Get Device Discovery Mode
This is used to get the discovery mode of the BT module.
Redpine Signals, Inc. Proprietary and Confidential
Page 39
WyzBee®
User Manual
Version 1.0
uint16 WyzBee_GetDiscoverMode (uint8
*p_mode)
Parameter Name
Description
[Out]p_mode
Stores the discovery mode value.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.12 Set Connection Mode
This is used to set the BT module in one of the two Connectability modes.
uint16 WyzBee_SetConnMode (uint8 mode)
Parameter Name
Description
[Out]mode
Mode – To enable/disable
0 – disable connection mode
1 – enable connection mode
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.13 Get Connection Mode
This is used to get the connectable mode.
uint16 WyzBee_GetConnMode (uint8
*p_mode)
Parameter Name
Description
[Out]p_mode
Stores the connection mode value.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
Redpine Signals, Inc. Proprietary and Confidential
Page 40
WyzBee®
User Manual
Version 1.0
6.2.14 Set Pair Mode
This will enable or disable the Pairing mode of the BT module.
uint16 WyzBee_SetPairMode (uint8 mode)
Parameter Name
Description
[Out]mode
Pair Mode – To enable/disable Authentication 0 –
disable Authentication mode
1 – enable Authentication mode
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.15 Get Pair Mode
This will retrieve the current pairing mode of the BT module.
uint16 WyzBee_GetPairMode (uint8 *p_mode)
Parameter Name
Description
[Out]p_mode
Stores the pair mode value.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.16 Remote Name Request
This is used to know the name of the remote BT device, using its BD
address.
uint16 WyzBee_RemoteNameReq (uint8 *p_remote_bd_addr)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 41
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In]p_remote bd_addr
Remote device BD address.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.17 Remote Name Request Cancel
This will cancel the request served by “Remote Name Request” command.
uint16 WyzBee_RemoteNameReqCancel (
uint8
*p_remote_bd_addr)
Parameter Name
Description
[In]p_remote bd_addr
Remote device BD address.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.18 Inquiry
This will perform an inquiry scan to find any BT devices in the vicinity.
uint16 WyzBee_Inquiry (uint8
inquiry_type,
uint32
Parameter Name
Description
[In] inquiry_type
Type
time_out)
0- Standard Inquiry
1 – Inquiry with RSSI
2 – Extended Inquiry
[In]time_out
Time out value in milli seconds (100 ms to 5000ms)
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
Redpine Signals, Inc. Proprietary and Confidential
Page 42
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
0 = SUCCESS
6.2.19 Inquiry Cancel
This will cancel the inquiry scan which was already in the process, served
by “Inquiry” command.
uint16 WyzBee_InquiryCancel (void)
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.20 Bond or Create Connection
This will creates bonding (connection) between the BT module and the
remote BT device based on BD address along with security.
uint16 WyzBee_Bond (uint8
*p_remote_addr)
Parameter Name
Description
[In]p_remote_addr
Remote device BD address.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.21 Bond Cancel
This will disconnect the connection between the BT module and the
remote BT device, only while the bonding is in progress.
uint16 WyzBee_BondCancel (uint8
*p_remote_addr)
Parameter Name
Description
[In]p_remote_addr
Remote device BD address.
Redpine Signals, Inc. Proprietary and Confidential
Page 43
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.22 Unbond or Disconnect
This un-bonds the device, which was already bonded, based on BD
address of the remote BT device.
uint16 WyzBee_UnBond (uint8
*p_remote_addr)
Parameter Name
Description
[In]p_remote_addr
Remote device BD address.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.23 Set Pin Type
This is used to set the PIN code or pass key of the local BT module.
uint16 WyzBee_SetPinType (uint8
Parameter Name
Description
[In]pin_type
PIN Type
pin_type)
0 – variable pin
1 – fixed pin
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.24 Get Pin Type
This is used to get the PIN code or pass key of the local BT module.
Redpine Signals, Inc. Proprietary and Confidential
Page 44
WyzBee®
User Manual
Version 1.0
uint16 WyzBee_GetPinType (uint8
Parameter Name
Description
[In]p_pin_type
PIN Type
*p_pin_type)
0 – variable pin
1 – fixed pin
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.25 Pincode Request Reply
The user pincode entry is used to respond on a user pin code entry
request. If we want to connect with remote device then we can respond
with positive reply. Else send negative reply.
uint16 WyzBee_PinCodeReply (
uint8
*p_remote_bdaddr,
uint8
replytype,
uint32
pincode)
Parameter Name
Description
[In] p_remote_bdaddr
Remote device BD address
[In]replytype
0 – negative reply
1 – positive reply
[In]pincode
Entered Pincode number(must be in string format
max string length is 16 bytes.).
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.26 Get Local Device Role
This gets the role of the local BT module when connected with a particular
remote BT device, based on BD address of the remote BT device.
uint16 WyzBee_GetDeviceRole (uint8
Redpine Signals, Inc. Proprietary and Confidential
*p_remote_addr,
Page 45
WyzBee®
User Manual
Version 1.0
uint8
*p_role)
Parameter Name
Description
[In] p_remote_addr
Remote device BD address
[Out]p_role
0 – Master role
1 – slave role
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.27 Set Local Device Role
This is used to change the current role of the local BT module, with
respect to the remote BT device.
uint16 WyzBee_SetDeviceRole (uint8 *p_remote_addr,
uint8 role)
Parameter Name
Description
[In] p_remote_addr
Remote device BD address
[In]role
0 – Master role
1 – slave role
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.28 Get Service List
This is used to search for the services supported by the remote BT
device.
uint16 WyzBee_GetRemoteDeviceServices (
uint8
uint32
*p_remote_addr,
*p_services,
uint8 nbr_services,
uint8 *p_nbr_found_sevices)
Redpine Signals, Inc. Proprietary and Confidential
Page 46
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] p_remote_addr
Remote device BD address
[Out]p_services
ServiceUUIDs[8]
[In]nbr_services
Maximum number of services
[Out]
p_nbr_found_sevices
Total number of found services
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.29 Search Service
This is used to find whether a particular service is supported by the
remote BT device.
uint16 WyzBee_SearchForServicce (uint8 *p_remote_addr,
uint32
Parameter Name
Description
[In]p_remote_addr
PIN Type
service_uuid)
0 – variable pin
1 – fixed pin
[In]service_uuid
UUID of the service.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.30 SPP Connect
This is used to establish SPP connection with the remote BT device,
specified by the BD address.
uint16 WyzBee_SPPConnect (uint8
*p_remote_addr)
Parameter Name
Description
[In]p_remote_addr
Remote device BD address.
Redpine Signals, Inc. Proprietary and Confidential
Page 47
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.31 SPP Disconnect
This is used to disconnect the SPP connection with the remote BT device.
uint16 WyzBee_SPPDisconnect (uint8 *p_remote_addr)
Parameter Name
Description
[In]p_remote_addr
Remote device BD address.
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.32 SPP Transfer
This is used to send data to the remote BT device using SPP profile. This
command contains a data length field, which tells the BT module about
the length of data in bytes user want to send from the application.
uint16 WyzBee_SPPTransfer (uint8
uint8
*p_remote_addr,
*p_data,
uint16
Parameter Name
Description
[In] p_remote_addr
Remote device BD address
[In]p_data
Data to be transferred
[In] data_len
Length of the data buffer
return value
error Code
data_len)
-2 = Command execution failure
Redpine Signals, Inc. Proprietary and Confidential
Page 48
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
-1 = Buffer Full
0 = SUCCESS
6.2.33 SPP Receive
This event is sent to the host when data is received from remote BT
device through SPP. This data_len field contains the length of data to be
send to the host.
uint16 WyzBee_SPPReceive (uint8
*p_data,
uint16
Parameter Name
Description
[Out]p_data
Data received
[In] data_size
Length of the data buffer
return value
error Code
data_size)
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.34 Accept SPP Connection
This accepts any incoming SPP connection.
uint16 WyzBee_BT_AcceptSppConnect (void)
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.2.35 Wait for connection completion
This waits for the completion of SPP connection.
uint16 WaitForSPPConnComplete (void)
Redpine Signals, Inc. Proprietary and Confidential
Page 49
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
error Code
-2 = Command execution failure
-1 = Buffer Full
0 = SUCCESS
6.3 Peripheral API
6.3.1 GPIO
This below table shows GPIO pins on the WyzBee Header.
Header name
Pin no.
Pin name
J2
11
GPIO_2
J3
7
GPIO_1
This API is used to initialize the GPIO pin as input or output based on dir
parameter with initialization done by parameter value.
Parameter
Name
Possible values
Description
[In] port
GPIO_LED2
Tri LED interface:RED colour
Tri LED interface:GREEN colour
Tri LED interface:BLUE colour
GPIO_LED3
GPIO_LED4
GPIO_2
GPIO_1
GPIO_I2CSDA
GPIO_I2CSCL
GPIO_UART2IN
GPIO interface
GPIO interface
I2C INTERFACE
I2C INTERFACE
GPIO_UART2OUT
UART INTERFACE
UART INTERFACE
GPIO_PWM2
PWM INTERFACE
PWM INTERFACE
GPIO_PWM1
GPIO_SPI2CS
GPIO_SPI2MISO
SPI
SPI
SPI
SPI
GPIO_ADC1
ADC INTERFACE
GPIO_SPI2CLK
GPIO_SPI2MOSI
INTERFACE
INTERFACE
INTERFACE
INTERFACE
Redpine Signals, Inc. Proprietary and Confidential
Page 50
WyzBee®
User Manual
Version 1.0
Parameter
Name
Possible values
Description
[In]value
HIGH
GPIO value
LOW
[In]direction
OUTPUT
GPIO direction
INPUT
6.3.1.1 GPIO Get
This API is used to read from the GPIO pin identified by the labels in n
the schematic.
Each GPIO pin is mapped to a port pin in the MCU.
WyzBeeGpio_Get(port)
6.3.1.2 GPIO Put
This API is used to write a value to the GPIO pin passed as port
parameter. Each port pin in MCU is mapped to different GPIO pin..
WyzBeeGpio_Put(port, value)
6.3.1.3 GPIO InitIn
This API is used to configure the GPIO pin as input with configurable
pullup.
WyzBeeGpio_InitIn(port, pullup)
6.3.1.4 GPIO InitOut
This API is used to configure the GPIO pin as output , and initializes to
the value given in the parameter.
WyzBeeGpio_InitOut(port,value)
6.3.1.5 GPIO Initialization
This API is used to initialize the GPIO pin as input or output based on dir
parameter with initialization done by parameter value .
WyzBeeGpio_Init(port,dir,value)
6.3.2 Timer
6.3.2.1 Timer Configuration Structure
A timer instance uses the following configuration structure of the type of
WyzBee _DualTimer_config_t:
Redpine Signals, Inc. Proprietary and Confidential
Page 51
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
u8Mode
Dt_FreeRun
Dt_Periodic
Dt_OneShot
Free-running mode
Periodic mode
One-shot mode
u8PrescalerDiv
Dt_PrescalerDiv1
Prescaler divisor 1
Dt_PrescalerDiv16
Prescaler divisor 16
Dt_PrescalerDiv256
Prescaler divisor 256
Dt_CounterSize16
16 Bit counter size
Dt_CounterSize32
32 Bit counter size
Dt_Channel0
channel 0
Dt_Channel1
channel 1
Dt_MaxChannels
Number of channels
u8CounterSize
ch_num
6.3.2.2 Initialization
This function will initialize the dual timer zero (DT0) channel in MCU with
the given countdown reload value.
err_t WyzBeeDualTimer_Init(
WyzBee_DualTimer_config_t dual_timer,
uint8_t ch_num)
Parameter Name
Description
[In] dual_timer
dual timer configurationstructure
[In] ch_num
channel number of dual timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.2.3 Load Time
This function will loads the time value for the dual timer.
This time is valid only for prescale division value Dt_PrescalerDiv16.
err_t WyzBeeDualTimer_LoadTime(uint32_t time,
uint8_t ch_num)
Parameter Name
Description
[In] time
time value in micro seconds to be loaded
[In] ch_num
channel number of dual timer
Redpine Signals, Inc. Proprietary and Confidential
Page 52
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.2.4 Interrupt Callback
This is the call back function when dual timer zero raises the interrupt.
err_t WyzBeeDualTimer_Attach_Callback(
timer_callback cb_Fn,
uint8_t ch_num)
Parameter Name
Description
[In] cb_Fn
[In] ch_num
callback function to be attached to the dual
timer
channel number of dual timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.3 I2C Library
The below I2C pins shows on the WyzBee headers.
Header name
Pin no.
Pin name
J2
12
I2C_SCL
J2
13
I2C_SDA
6.3.3.1 I2C Configuration Structure
The WyzBee I2C library uses WyzBee I2c_Config_t structure for
initialization
Parameter Name
Value
Description
I2cDataRate
-
Baud rate (bps)
I2cMode
I2cMasterMode
Use I2C in Master Mode
I2cSlaveMode
Use I2C in Slave Mode
I2cNoizeFilterLess40M
8 MHz <= APB1 bus clock <
40 MHz
I2cNoizeFilterLess60M
40 MHz <= APB1 bus clock
< 60 MHz
NoiseFilterConfig
I2cNoizeFilterLess80M
Redpine Signals, Inc. Proprietary and Confidential
60 MHz <= APB1 bus clock
Page 53
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
< 60 MHz
I2cNoizeFilterLess100M
80 MHz <= APB1 bus clock
< 100 MHz
I2cNoizeFilterLess120M
I2cNoizeFilterLess140M
I2cNoizeFilterLess160M
I2cNoizeFilterLess180M
I2cNoizeFilterLess200M
100 MHz <= APB1 bus clock
< 120 MHz
120 MHz <= APB1 bus clock
< 140 MHz
140 MHz <= APB1 bus clock
< 160 MHz
160 MHz <= APB1 bus clock
< 180 MHz
180 MHz <= APB1 bus clock
< 200 MHz
I2cNoizeFilterLess220M
I2cNoizeFilterLess240M
I2cNoizeFilterLess260M
I2cNoizeFilterLess280M
200 MHz <= APB1 bus clock
< 220 MHz
220 MHz <= APB1 bus clock
< 240 MHz
240 MHz <= APB1 bus clock
< 260 MHz
260 MHz <= APB1 bus clock
< 280 MHz
I2cNoizeFilterLess300M
I2cNoizeFilterLess320M
I2cNoizeFilterLess340M
I2cNoizeFilterLess360M
I2cNoizeFilterLess380M
SlaveAddress
280 MHz <= APB1 bus clock
< 300 MHz
300 MHz <= APB1 bus clock
< 320 MHz
320 MHz <= APB1 bus clock
< 340 MHz
340 MHz <= APB1 bus clock
< 360 MHz
360 MHz <= APB1 bus clock
< 380 MHz
I2cNoizeFilterLess400M
380 MHz <= APB1 bus clock
< 400 MHz
Slave Address range
Slave address
0x00 - 0x7F
Redpine Signals, Inc. Proprietary and Confidential
This is effective when Slave
mode is used (I2cMode is set
to be I2cSlaveMode)
Page 54
WyzBee®
User Manual
Version 1.0
6.3.3.2 Initialization
This function initializes the I2C channel on expansion header of WyzBee
board.
err_t WyzBeeI2c_Init(WyzBeeI2c_Config_t *p_config)
Parameter Name
Description
Initializes the WyzBee I2C module
[In] p_config
return value
ERR_INVALID_PARMS
ERR_NONE
6.3.3.3 De Initialization
This function De initializes the I2C channel on expansion header of
WyzBee board.
err_t WyzBeeI2c_DeInit( void )
Parameter Name
Description
[In] none
none
return value
ERR_NONE
6.3.3.4 I2C Write
This function writes the data to the slave connected on I2C channel.
err_t
WyzBeeI2c_Write( uint8_t
slave_addr,
uint8_t
uint16_t
*p_buf,
buf_len)
Parameter Name
Description
[In] slave_addr
Slave I2C address
[In] p_buf
Pointer to the Transmit data buffer
[In] buf_len
Date length to be transmitted
return value
ERR_I2C_UNINITIALIZED ERR_INVALID_PARMS
ERR_I2C_TIMEOUT
6.3.3.5 I2C Read
This function is used to read data from the I2C slave.
err_t WyzBeeI2c_Read(uint8_t
Redpine Signals, Inc. Proprietary and Confidential
slave_addr,
Page 55
WyzBee®
User Manual
Version 1.0
uint8_t
*p_buf,
uint16_t
*p_buf_len)
Parameter Name
Description
[In] slave_addr
Slave I2C address
[Out] p_buf
Pointer to the Receivedata buffer
[Out] buf_len
Date length to be received
return value
ERR_I2C_UNINITIALIZED ERR_INVALID_PARMS
ERR_I2C_TIMEOUT
6.3.3.6 Transmit and Receive Complete
This function is used to Waits until TX and RX completion.
static err_t WyzBeeI2cWaitTxRxComplete(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_I2C_TIMEOUT
6.3.3.7 Transmit Interrupt
This function is used to I2C TX interrupt service routine , sets the I2C
transmitting conditions and sends the data.
static void WyzBeeI2c_TxIsr(void)
Parameter Name
Description
[In] none
none
return value
None
6.3.3.8 Receive Interrupt
This function is used to I2C RX interrupt service routine , sets the I2C
Receiving conditions and Receives the data.
static void WyzBeeI2c_RxIsr(void)
Parameter Name
Description
[In] none
none
return value
None
Redpine Signals, Inc. Proprietary and Confidential
Page 56
WyzBee®
User Manual
Version 1.0
6.3.3.9 I2C Interrupt
This function is used to I2C status interrupt service routine.
static void WyzBeeI2c_SatusIsr(void)
Parameter Name
Description
[In] none
none
return value
None
6.3.4 SPI Library
This below table shows the SPI pins on the WyzBee header.
Header name
Pin no.
Pin name
J3
8
SPI2_MOSI
J3
9
SPI2_MISO
J3
10
SPI2_CLK
J3
11
SPI2_CS
6.3.4.1 SPI Configuration structure
The WyzBee SPI library is used WyzBee spi_Config_t:
Parameter Name
Value
Description
BaudRate
-
Baud rate (bps)
Mode
SpiMaster
Master mode (generating
serial clock)
SpiSlave
Slave mode (external serial
clock)
SpiSyncWaitZero
0 wait time insertion
SpiSyncWaitOne
1 wait time insertion
SpiSyncWaitTwo
2 wait time insertion
SpiSyncWaitThree
3 wait time insertion
SpiFiveBits
5 Bit character length
SpiSixBits
6 Bit character length
SpiSevenBits
7 Bit character length
SpiEightBits
8 Bit character length
SpiNineBits
9 Bit character length
SpiTenBits
10 Bit character length
WaitTime
DateLen
Redpine Signals, Inc. Proprietary and Confidential
Page 57
WyzBee®
User Manual
Version 1.0
Parameter Name
BitDirection
ClockLvl
UseInterrupts
Value
Description
SpiElevenBits
11 Bit character length
SpiTwelveBits
12 Bit character length
SpiThirteenBits
13 Bit character length
SpiFourteenBits
14 Bit character length
SpiFifteenBits
15 Bit character length
SpiSixteenBits
16 Bit character length
SpiMsbBitFirst
MSB bit First
SpiLsbBitFirst
LSB bit First
SpiClockMarkHigh
HIGH to LOW clock
SpiClockMarkLow
LOW to HIGH clock
SpiUseIntrMode
Enable SPI interrupts
SpiNoUseIntrmode
Disable SPI interrupts
TxIsr
RxIsr
-
Callback function, if RX buffer is
filled more than 1 byte
Callback function, if TX Buffer is
empty
6.3.4.2 Initialization
This function initializes the SPI channel on expansion header of the
WyzBee board with the default values.
err_t WyzBeeSpi_Init(WyzBeeSpi_Config_t *p_config)
Parameter Name
Description
[In] p_config
pointer to the configuration WyzBee SPI
configurationstructure
return value
ERR_NONE
6.3.4.3 De Initialization
This function de initializes the SPI channel on expansion header of the
WyzBee board.
err_t WyzBeeSpi_DeInit(void)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 58
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] none
none
return value
ERR_NONE
6.3.4.4 SPI Send
This function will Sends the data on SPI MOSI line.
err_t WyzBee Spi_SyncSend(uint8_t *p_buf,
uint16_t buf_len)
Parameter Name
Description
[In] p_buf
[In] buf_len
pointer to the transmit buffer indicates data to be
sent
Buffer length indicates no.of bytes to be transmitted
return value
ERR_INVALID_PARMS
ERR_NONE
6.3.4.5 SPI Send/Receive
This function is used to send and receive the data over SPI channel.
Dedicated Chip selection pin on expansion header is automatically
handled by this transfer function.
err_t WyzBeeSpi_SyncSendRecv(uint8_t *p_tx_buf,
uint16_t tx_len,
uint8_t *p_rx_buf,
uint16_t rx_len)
Parameter Name
Description
[In] p_tx_buf
pointer to the transmit buffer indicates data to
be sent
Transmit data length
[In] tx_len
[In] rx_len
pointer to the receive buffer, where receive data
to be stored
Receive data length
return value
ERR_INVALID_PARMS
[In] p_rx_buf
ERR_NONE
Redpine Signals, Inc. Proprietary and Confidential
Page 59
WyzBee®
User Manual
Version 1.0
6.3.4.6 SPI Receive
This function will Receive the data on SPI MISO line.
err_t
WyzBeeSpi_SyncRecv(uint8_t *buf ,
uint16_t buf_len)
Parameter Name
Description
[In] buf
pointer to the buffer where receive data is stored
[In] buf_len
buffer length , no.of bytes to be read
return value
ERR_INVALID_PARMS
ERR_NONE
6.3.4.7 Enable Slave Chip
This function use to enable the SPI slave chip.
void WyzBeeSpi_CsEnable(void)
Parameter Name
Description
[In] none
none
return value
None
6.3.4.8 Disable Slave Chip
This function use to disable the SPI slave chip.
void WyzBeeSpi_CsDisable(void)
Parameter Name
Description
[In] none
none
return value
None
6.3.4.9 Enable Transmit Interrupt
This function is used to enable the interrupt on TX pin on SPI mode.
err_t WyzBeeSpi_TxIntrEnable(void)
Parameter Name
Description
[In] none
none
Redpine Signals, Inc. Proprietary and Confidential
Page 60
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
ERR_UNKNOWN
ERR_NONE
6.3.4.10
Disable Transmit Interrupt
This function is used to enable the interrupt on TX pin on SPI mode.
err_t WyzBeeSpi_TxIntrDisable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.11
Enable Receive Interrupt
This function is used to enable the interrupt on RX pin on SPI mode.
err_t WyzBeeSpi_RxIntrEnable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.12
Disable receive Interrupt
This function is used to disble the interrupt on RX pin on SPI mode.
err_t WyzBeeSpi_RxIntrDisable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.13
SPI Write
This function will Writes the single character on SPI.
This function is specifically used in ISR mode, not used in blocking mode.
Redpine Signals, Inc. Proprietary and Confidential
Page 61
WyzBee®
User Manual
Version 1.0
err_t WyzBeeSpi_Write(uint8_t tx_char)
Parameter Name
Description
[In] tx_char
Writes the single character on SPI
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.14
SPI Read
This function will reads the single character on SPI.
This function is specifically used in ISR mode, not used in blocking mode.
uint8_t WyzBee Spi_Read(void)
Parameter Name
Description
[In] none
none
return value
received data on SPI
6.3.4.15
Receiver Enable
This function used to Enables the Receiver module on SPI.
err_t WyzBeeSpi_RxEnable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.16
Transmitter Enable
This function used to Enables the transmitter module on SPI.
err_t WyzBeeSpi_TxEnable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.17
Receiver Disable
This function used to disable the Receiver module on SPI.
Redpine Signals, Inc. Proprietary and Confidential
Page 62
WyzBee®
User Manual
Version 1.0
err_t WyzBeeSpi_RxDisable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.4.18
Transmitter Disable
This function used to disable the transmitter module on SPI.
err_t WyzBeeSpi_TxDisable(void)
Parameter Name
Description
[In] none
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5 UART Library
This below table shows the UART pins on the WyzBee header.
Header name
Pin no.
Pin name
J3
4
UART2_OUT
J3
5
UAR2_IN
6.3.5.1 UART Configuration Structure
The UART library uses the WyzBeeUart_Config_t:
Parameter Name
Value
Description
BaudRate
-
Baud rate (bps)
Mode
UartNormal
Norormal mode
Parity
StopBit
UartMulti
Multi-Processor Mode
UartParityNone
No parity bit is used
UartParityEven
Even parity bit is used
UartParityOdd
Odd parity bit is used
UartOneStopBit
1 Stop Bit
UartTwoStopBits
2 Stop Bits
Redpine Signals, Inc. Proprietary and Confidential
Page 63
WyzBee®
User Manual
Version 1.0
Parameter Name
DataLength
BitDirection
ClockLvl
HwFlowCntl
UseInterrupts
Value
Description
UartThreeStopBits
3 Stop Bits
UartFourStopBits
4 Stop Bits
UartFiveBits
5 Bit character length
UartSixBits
6 Bit character length
UartSevenBits
7 Bit character length
UartEightBits
8 Bit character length
UartNineBits
9 Bit character length
UartTenBits
10 Bit character length
UartElevenBits
11 Bit character length
UartTwelveBits
12 Bit character length
UartThirteenBits
13 Bit character length
UartFourteenBits
14 Bit character length
UartFifteenBits
15 Bit character length
UartSixteenBits
16 Bit character length
1
MSB bit First
0
LSB bit First
1
NRZ
0
inverted NRZ
1
Not use Hardware Flow
0
Use Hardware Flow
1
Enable Uart interrupts
0
Disable Uart interrupts
TxIsr
Transmit interrupt
RxIsr
Receive interrupt
6.3.5.2 Initialization
This function is used to initialize the UART channel on Expansion header
of WyzBee board.
err_t WyzBeeUart_Init(
WyzBee Uart_Config_t *p_config)
Parameter Name
Description
[In] p_config
pointer to the WyzBee UART configuration
structure
return value
ERR_INVALID_PARMS
ERR_NONE
Redpine Signals, Inc. Proprietary and Confidential
Page 64
WyzBee®
User Manual
Version 1.0
6.3.5.3 De Initialization
This function is used to De initialize the UART channel on Expansion
header of WyzBee board.
err_t WyzBeeUart_DeInit(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
6.3.5.4 Send
This function is used to send character on TX pin of UART.
err_t WyzBeeUart_SendChar(uint8_t tx_char)
Parameter Name
Description
[In] tx_char
data to be sent on the TX pin.
return value
ERR_NONE
UART_TIMEOUT_VALUE
6.3.5.5 Receive
This function is used to receive the character on the RX pin on expansion
header.
int8_t
WyzBeeUart_RecvChar(void)
Parameter Name
Description
[In] none
return value
rx_char
6.3.5.6 Send String
This function is used to send the string on TX pin.
err_t
WyzBeeUart_SendString(uint8_t *p_buf)
Parameter Name
Description
[In] p_buf
pointer to the buffer to be sent on TX pin.
return value
ERR_INVALID_PARMS
ERR_NONE
Redpine Signals, Inc. Proprietary and Confidential
Page 65
WyzBee®
User Manual
Version 1.0
6.3.5.7 Receive String
This function is used to receive the string on the RX pin.
err_t
WyzBeeUart_RecvString(uint8_t *p_buf ,
uint16_t *p_buf_len)
Parameter Name
Description
[Out] p_buf
[Out] p_buf_len
pointer to the buffer to be sent on RX pin.
pointer to the buffer length to be receive on RX pin
return value
ERR_NONE
6.3.5.8 Transmit Channel Enable
This function is used to enable the TX channel of the UART.
err_t WyzBeeUart_TxEnable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.9 Transmit Channel Disable
This function is used to Disable the TX channel of the UART.
err_t WyzBeeUart_TxDisable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.10
Receive Channel Enable
This function is used to enable the RX channel of the UART.
err_t WyzBeeUart_RxEnable(void)
Parameter Name
Description
[In] config
none
Redpine Signals, Inc. Proprietary and Confidential
Page 66
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.11
Receive Channel Disable
This function is used to disable the RX channel of the UART.
err_t WyzBeeUart_RxDisable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.12
Write
This function is used to write the data on TX pin on UART.
This function is used in TX ISR based mode.
err_t WyzBeeUart_Write(uint8_t tx_char)
Parameter Name
Description
[In] tx_char
pointer to the buffer to be sent on TX pin.
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.13
Read
This function is used to read the data on RX pin on UART.
This function is used in RX ISR based mode.
uint8_t WyzBeeUart_Read(void)
Parameter Name
Description
[In] config
none
return value
Received the data on RX pin
6.3.5.14
Receive Interrupt Enable
This function is used to enable the interrupt on RX pin on uart interrupt
mode.
err_t WyzBeeUart_RxIntrEnable(void)
Redpine Signals, Inc. Proprietary and Confidential
Page 67
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.15
Receive Interrupt Disable
This function is used to disable the interrupt on RX pin on uart interrupt
mode.
err_t WyzBeeUart_RxIntrDisable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.16
Transmit Interrupt Enable
This function is used to enable the interrupt on TX pin on uart interrupt
mode.
err_t WyzBeeUart_TxIntrEnable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.5.17
Transmit Interrupt Disable
This function is used to disable the interrupt on TX pin on uart interrupt
mode.
err_t WyzBeeUart_TxIntrDisable(void)
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
Redpine Signals, Inc. Proprietary and Confidential
Page 68
WyzBee®
User Manual
Version 1.0
6.3.6 ADC
This below table shows the ADC pin on the WyzBee header.
Header name
Pin no.
Pin name
J3
6
ADC_1
6.3.6.1 ADC Configuration Structure
The WyzBee ADC library is uses the WyzBeeAdc_Config_t
Parameter Name
Value
Description
ScanMode
AdcScanSingleConversi
on
AdcScanRepeatConversi
on
Single mode of conversion
AdcValue1
Set value * 1
SampleTime
Repeat mode of conversion
AdcValue4
Set value * 4
AdcValue8
Set value * 8
AdcValue16
Set value * 16
AdcValue32
Set value * 32
AdcValue64
Set value * 62
AdcValue128
Set value * 128
AdcValue256
Set value * 256
AdcClkDiv1
Frequency division ratio 1
AdcClkDiv2
Frequency division ratio 2
AdcClkDiv3
Frequency division ratio 3
AdcClkDiv4
Frequency division ratio 4
AdcClkDiv5
Frequency division ratio 5
AdcClkDiv6
Frequency division ratio 6
AdcClkDiv7
Frequency division ratio 7
AdcClkDiv8
Frequency division ratio 8
AdcClkDiv9
Frequency division ratio 9
AdcClkDiv10
Frequency division ratio 10
AdcClkDiv11
Frequency division ratio 11
AdcClkDiv12
Frequency division ratio 12
AdcClkDiv13
Frequency division ratio 13
AdcClkDiv14
Frequency division ratio 14
AdcClkDiv15
Frequency division ratio 15
AdcClkDiv16
Frequency division ratio 16
AdcClkDiv17
Frequency division ratio 17
SamplingTime
ClkDivRatio
Redpine Signals, Inc. Proprietary and Confidential
Page 69
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
AdcClkDiv18
Frequency division ratio 18
AdcClkDiv19
Frequency division ratio 19
AdcClkDiv20
Frequency division ratio 20
AdcClkDiv21
Frequency division ratio 21
AdcClkDiv22
Frequency division ratio 22
AdcClkDiv23
Frequency division ratio 23
AdcClkDiv24
Frequency division ratio 24
AdcClkDiv25
Frequency division ratio 25
AdcClkDiv26
Frequency division ratio 26
AdcClkDiv27
Frequency division ratio 27
AdcClkDiv28
Frequency division ratio 28
AdcClkDiv29
Frequency division ratio 29
AdcClkDiv30
Frequency division ratio 30
AdcClkDiv31
Frequency division ratio 31
AdcClkDiv32
Frequency division ratio 32
AdcClkDiv33
Frequency division ratio 33
AdcClkDiv34
Frequency division ratio 34
AdcClkDiv35
Frequency division ratio 35
AdcClkDiv36
Frequency division ratio 36
AdcClkDiv37
Frequency division ratio 37
AdcClkDiv38
Frequency division ratio 38
AdcClkDiv39
Frequency division ratio 39
AdcClkDiv40
Frequency division ratio 40
AdcClkDiv41
Frequency division ratio 41
AdcClkDiv42
Frequency division ratio 42
AdcClkDiv43
Frequency division ratio 43
AdcClkDiv44
Frequency division ratio 44
AdcClkDiv45
Frequency division ratio 45
AdcClkDiv46
Frequency division ratio 46
AdcClkDiv47
Frequency division ratio 47
AdcClkDiv48
Frequency division ratio 48
AdcClkDiv49
Frequency division ratio 49
AdcClkDiv50
Frequency division ratio 50
AdcClkDiv51
Frequency division ratio 51
AdcClkDiv52
Frequency division ratio 52
AdcClkDiv53
Frequency division ratio 53
AdcClkDiv54
Frequency division ratio 54
AdcClkDiv55
Frequency division ratio 55
AdcClkDiv56
Frequency division ratio 56
AdcClkDiv57
Frequency division ratio 57
Redpine Signals, Inc. Proprietary and Confidential
Page 70
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
AdcClkDiv58
Frequency division ratio 58
AdcClkDiv59
Frequency division ratio 59
AdcClkDiv60
Frequency division ratio 60
AdcClkDiv61
Frequency division ratio 61
AdcClkDiv62
Frequency division ratio 62
AdcClkDiv63
Frequency division ratio 63
AdcClkDiv64
Frequency division ratio 64
AdcClkDiv65
Frequency division ratio 65
ADC conversion complete
CallBack Function
AdcCb
-
ErrCb
IntrMode
ADC Conversion error CallBack
Function
AdcNoUseIntr
Do not use ADC interrupt mode
Use ADC interrupt mode
AdcUseIntr
6.3.6.2 Initialization
This function is used to initialize the ADC module in channel 6 which is
available on expansion header of WyzBee board.
Define global variables for storing the digital data and these global
variables are updated by ADC conversion done interrupt call back
function.
err_t WyzBeeAdc_Init(WyzBeeAdc_Config_t *p_config )
Parameter Name
Description
[In] p_config
This is the sampling time of the ADC in milli
seconds. For every sampling_time
milliseconds time duration ADC will give
digital output from channel 6
return value
ERR_ADC_UNINITIALIZED
ERR_NONE
6.3.6.3 De-Initialization
This function will disable the adc module.
en_t WyzBeeAdc_DeInit(volatile stc_adcn_t* pstcAdc)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 71
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] pstcAdc
Pointer to the Adc instance structure to disable
return value
ERR_NONE
ERR_UNKNOWN
6.3.6.4 Trigger the ADC
This function will trigger the ADC conversion by Software Trigger.
err_t WyzBeeAdc_ConvSwTrigger( void )
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.6.5 ADC Readiness
This function will Checks the ADC readiness.
err_t WyzBeeAdc_ReadyStatus( void )
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_ADC_NOTR_READY
6.3.6.6 Stop ADC
This function will Stops the ADC conversion.
err_t WyzBeeAdc_Stop( void )
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.6.7 Conversion Status
This function will Checks the ADC conversion status.
err_t WyzBeeAdc_ConversionStatus( void)
Redpine Signals, Inc. Proprietary and Confidential
Page 72
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] config
none
return value
ERR_NONE
ERR_ADC_CONVERSION_IN_PROGRES
6.3.6.8 Read
This function will Reads the ADC FIFO data.
uint32_t WyzBee Adc_ReadData( void )
Parameter Name
Description
[In] none
none
return value
Analog volatage on ADC pi n
ERR_NONE
ERR_UNKNOWN
6.3.6.9 Data Valid
This function will Validates the ADC data.
err_t WyzBeeAdc_DataValid( uint32_t
Parameter Name
[In] adc_data
return value
6.3.6.10
adc_data )
Description
ADC FIFO value
ERR_ADC_DATA_INVALID
ADC Enable
This function will Enables The ADC module .
err_t WyzBeeAdc_Enable( void )
Parameter Name
Description
[In] adc_data
none
return value
ERR_NONE
ERR_UNKNOWN
6.3.7 PWM
This below table shows the PWM pins on the WyzBee header.
Redpine Signals, Inc. Proprietary and Confidential
Page 73
WyzBee®
User Manual
Version 1.0
Header name
Pin no.
Pin name
J3
12
PWM1
J3
13
PWM2
6.3.7.1 PWM Configuration Structure
A PWM timer instance uses the following configuration structure of the type of
WyzBeePWM_Timer_Config_t:
Parameter Name
Value
Description
enPres
Presclr_None
PWM prescaler clock: no
division
PWM prescaler clock: ¼
PWM prescaler clock: 1/16
PWM prescaler clock: 1/128
PWM prescaler clock: 1/256
Use external clock and count
at rising edge
Use external clock and count
at falling edge
Use external clock and count
at both edge
PWM prescaler clock: 1/512
PWM prescaler clock: 1/1024
PWM prescaler clock: 1/2048
Presclr_Div4
Presclr_Div16
Presclr_Div128
Presclr_Div256
Presclr_ExtClkRising
Presclr_ExtClkFalling
Presclr_ExtClkBoth
Presclr_Div512
Presclr_Div1024
Presclr_Div2048
enRestartEn
Restart_Disable
Restart_Enable
Disable PWM restart
Enable PWM restart
enOutputMask
Output_Normal
Output normal PWM wave
Mask PWM wave
Output_Mask
enExtTrig
enOutputPolarity
ExtTrig_Disable
Disable external trigger
ExtTrig_Rising
Enable external trigger with
rising edge
ExtTrig_Falling
Enable external trigger with
falling edge
ExtTrig_Both
Enable external trigger with
both edge
Polarity_Low
Initial polarity: low
Redpine Signals, Inc. Proprietary and Confidential
Page 74
WyzBee®
User Manual
Version 1.0
Parameter Name
enMode
Value
Description
Polarity_High
Initial polarity: high
Continuous
Continuous mode
Oneshot
One-shot mode
6.3.7.2 Initializing PWM Timer
This function initializes the PWM unit on GPIO6 pin of WyzBee board.
err_t WyzBeePWM_Init_Timer(
WyzBee_PWM_Timer_Config_t* p_pwmtimer,
base_timer_t* p_bt)
Parameter Name
Description
[In] p_pwmtimer
base timer configuration structur
[In] p_bt
base timer to select
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.7.3 PWM Timer Callback
This function initializes the PWM Timer callback functions
err_t WyzBeePWM_Config_InterruptCallback(
WyzBeePWM_Interrupt_Config_t* p_pwminterrupt,
WyzBeePWM_Interrupt_Callback_t* p_pwmcallback,
base_timer_t* p_bt)
Parameter Name
Description
[In] p_pwminterrupt
interrupt structure to configure types interrupts
p_pwmcallback
[In] p_bt
interrupt callback structure to initialize callback
functions
selected base timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.7.4 PWM Base Select
This function initializes the PWM base timer.
Redpine Signals, Inc. Proprietary and Confidential
Page 75
WyzBee®
User Manual
Version 1.0
err_t WyzBeePWM_Select_BaseTimer(uint8_t bt_number,
en_WyzBee_bt_io_mode_t io_mode,
en_WyzBee_bt_timer_mode_t timer_mode,
base_timer_t* p_bt)
Parameter Name
Description
[In] bt_number
select the base timer
io_mode
base timer io mode
[In] timer_mode
base timer in timer mode
[In] p_bt
select the base timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.7.5 PWM Pin
This function will associates MCU pin to PWM Timer.
err_t WyzBeePWM_Select_PWMPin(uint8_t
pwm_pin)
Parameter Name
Description
[In] pwm_pin
configure the base timer to the optional pins
return value
6.3.7.6 Configuring PWM frequency
This function is used the PWM Timer to the selected frequency and duty
cycle.
err_t WyzBeePWM_Config_DutyCycle(
uint16_t frequency,
uint16_t duty_cycle,
base_timer_t* p_bt)
Parameter Name
Description
[In] frequency
frequency of pwm waveform
duty_cycle,
duty cycle of pwm waveform
[In] p_bt
selected base timer
return value
ERR_INVALID_PARMS
Redpine Signals, Inc. Proprietary and Confidential
Page 76
WyzBee®
User Manual
Version 1.0
6.3.7.7 PWM Start
This function will Start the PWM Timer after initialization.
err_t WyzBeePWM_Start_PWM(base_timer_t* p_bt)
Parameter Name
Description
[In] p_bt
selected base timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.7.8 Trigger by software
This function will Start triggered by software.
err_t WyzBeePWM_EnableSwTrig(base_timer_t* p_bt)
Parameter Name
Description
[In] p_bt
selected base timer
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.7.9 Disable PWM Timer Interrupt
This function is used to disable the PWM timer.
err_t WyzBeePWM_DisableInt(base_timer_t* p_bt,
WyzBee_PWM_Interrupt_Config_t* p_pwminterrupt)
Parameter Name
Description
[In] p_bt
base timer to select
[In] p_pwminterrupt
interrupt structure to configure types interrupts
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.8 Watchdog
The WyzBee library sets interrupt callback functions to be called, in which
the user has to feed the Software Watchdog.
The WyzBee library uses the WyzBee _swwdg_config_t:
Parameter Name
Value
Description
u32LoadValue
-
Timer interval
Redpine Signals, Inc. Proprietary and Confidential
Page 77
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
bResetEnable
TRUE
Enables SW watchdog reset
FALSE
Disables SW watchdog reset
TRUE
Enables Window watchdog mode
bWinWdgEnable
Disables Window watchdog mode
FALSE
bWinWdgResetEnable
TRUE
Enables reset when reload without
timing window was occurred
Disables reset when reload without
timing window was occured
FALSE
u8TimingWindow
swwdg_timing_wind
ow_100
swwdg_timing_wind
ow_75
swwdg_timing_wind
ow_50
Reload can be executed at less than
or equal to WDOGLOAD
Reload can be executed at less than
or equal to 75% of WDOGLOAD
Reload can be executed at less than
or equal to 50% of WDOGLOAD
Reload can be executed at less than
or equal to 25% of WDOGLOAD
swwdg_timing_wind
ow_25
6.3.8.1 Initialization
This function is used to Initializes the Software Watchdog block.
err_t WyzBee _Swwdg_Init(
WyzBee _swwdg_config_t* Config)
Parameter Name
Description
[In] Config
A pointer to a structure WyzBee
_swwdg_config_t
return value
ERR_NONE
ERR_INVALID_PARMS
6.3.8.2 De-Initialization
This functiom is used to Un-initializes the Software Watchdog block.
void WyzBee_Swwdg_DeInit(void)
Redpine Signals, Inc. Proprietary and Confidential
Page 78
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] none
return value
6.3.8.3 Call Function
This function feeds the Software Watchdog with the unlock, feed, and
lock sequence
void WyzBee_Swwdg_Feed(void)
Parameter Name
Description
[In] none
return value
6.3.8.4 Interrupt Callback
The callback function is registered by Swwdg_Start()and called in the
interrupt handler when the Software Watchdog block generates an
interrupt.
err_t WyzBee_Swwdg_Start(func_ptr_t SwwdgCback)
Parameter Name
Description
[In] SwwdgCback
Start the Software Watchdog
return value
Ok ErrorOperationInProgress
6.3.8.5 Stop WDT
This function is used to stop the software watch dog timer.
void WyzBee_Swwdg_Stop(void)
Parameter Name
Description
[In] none
none
return value
none
6.3.8.6 Write Load Value
This function is used to write the load value for Software Watchdog.
void WyzBee_Swwdg_WriteWdgLoad(uint32_t LoadValue)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 79
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] LoadValue
load value
return value
none
6.3.8.7 Read Value
This function is used to Read the count value for Software Watchdog.
uint32_t WyzBee_Swwdg_ReadWdgValue(void)
Parameter Name
Description
[In] none
none
return value
ReadWdgValue :Read watch dog value
6.3.9 Systicks
6.3.9.1 Initialization
This function will initializes the systick timer.
void sys_ticks_init(void)
Parameter Name
Description
[In] none
return value
6.3.9.2 Delay
This function is used to produce delay in milli seconds based on systicks.
void delay (uint32
_delay)
Parameter Name
Description
[In] _delay
delay parameter in milliseconds
return value
none
6.3.10 External Interrupts
This below congfiguration and WyzBee API functions for using external
and the non-maskable interrupt (NMI).no pins are using NMI on WyzBee
header.
6.3.10.1
External Interrupt Configuration structure
The WyzBee External interrupt library is uses the
WyzBee_exint_config_t;
Redpine Signals, Inc. Proprietary and Confidential
Page 80
WyzBee®
User Manual
Version 1.0
Parameter Name
Value
Description
abEnable[32u]
TRUE
External interrupt enable
aenLevel[32u]
FALSE
External interrupt disable
CalExIntLowLevel
"L" level detection
CalExIntHighLevel
"H" level detection
CalExIntRisingEdge
Rising edge detection
CalExIntFallingEdge
Falling edge detection
CallBack functionpointer
apfnExintCallback[32u]
6.3.10.2
Non-Maskable Interrupt(NMI) Configuration Structure
The WyzBee NMI interrupt library is uses the
WyzBee_exint_nmi_config_t;
Parameter Name
Value
Description
bTouchNVIC
TRUE
NVIC is initialized by NMI
FALSE
V
NVIC is initialized by other peripheral
CallBack functionpointer
pfnNMICallback
6.3.10.3
Initialization
This function initializes the external interrupt channel specified in the
configuration structure for their levels and callback functions. The NVIC is
initialized too.
err_t WyzBee_Exint_Init(
WyzBee _exint_config_t* Config)
Parameter Name
Description
[In] Config
Pointer to configuration structure
return
ERR_NONE
ERR_INVALID_PARMS
Redpine Signals, Inc. Proprietary and Confidential
Page 81
WyzBee®
User Manual
Version 1.0
6.3.10.4
De-Initialization
err_t WyzBee_Exint_DeInit(void)
Parameter Name
Description
[In] none
return value
6.3.10.5
ERR_NONE
Channel Enable
This function enables a single EXINT channel
err_t WyzBee_Exint_EnableChannel(uint8_t u8Channel)
Parameter Name
Description
[In] u8Channel
channel number
return
ERR_NONE
ERR_INVALID_PARMS
6.3.10.6
Channel Disable
This function disables a single EXINT channel.
err_t WyzBee_Exint_DisableChannel(
uint8_t u8Channel)
Parameter Name
Description
[In] u8Channel
channel number
return
ERR_NONE
ERR_INVALID_PARMS
6.3.10.7
NMI Initialization
This non maskable interrupt is used to initialize the NMI configuration.
err_t WyzBee_Exint_Nmi_Init(
WyzBee _exint_nmi_config_t* Config)
Parameter Name
Description
[In] Config
Pointer to configuration structure
return
ERR_NONE
ERR_INVALID_PARMS
Redpine Signals, Inc. Proprietary and Confidential
Page 82
WyzBee®
User Manual
Version 1.0
6.3.10.8
NMI De-Initialization
This non maskable interrupt is used to de initialize the NMI configuration.
err_t WyzBee_Exint_Nmi_DeInit(
WyzBee _exint_nmi_config_t* Config)
Parameter Name
Description
[In] Config
Pointer to configuration structure
return
ERR_NONE
ERR_INVALID_PARMS
6.4 External Peripheral API
6.4.1 TriLED
6.4.1.1 Initialization
Three port pins of MCU are connected to Tri LED for RGB color display.
This function is used to configure the MCU port pins as GPIO pins and
write active HIGH data onto GPIO pins. Tri LED is in OFF state when
HIGH is written on GPIO pins.tri LED is in ON state when LOW is written
on GPIO pin.
WyzBee Gpio_Init(port,dir,value);
Parameter
Name
Possible values
Description
[In] port
GPIO_LED2
Tri LED interface:RED colour
Tri LED interface:GREEN colour
Tri LED interface:BLUE colour
GPIO_LED3
GPIO_LED4
[In]value
HIGH
LOW
[In]direction
OUTPUT
Tri LED OFF state
Tri LED ON state
GPIO direction
INPUT
6.4.1.2 Red ON/OFF
This is function used to turn ON/OFF RED LED of Tri LED by using GPIO
pin.
WyzBeeGpio_Init(port,dir,value)
Redpine Signals, Inc. Proprietary and Confidential
Page 83
WyzBee®
User Manual
Version 1.0
Parameter
Name
Possible values
Description
[In] port
GPIO_LED2
Tri LED interface:RED colour
[In]value
HIGH
RED LED in OFF state
RED LED in ON state
LOW
[In]direction
OUTPUT
GPIO direction
INPUT
6.4.1.3 Green ON/OFF
This is function used to turn ON/OFF GREEN LED in on board TRI LED by
using GPIO pin.
Prototype : WyzBeeGpio_Init(port,dir,value)
Parameter
Name
Possible values
Description
[In] port
GPIO_LED3
Tri LED interface:GREEN colour
[In]value
HIGH
GREEN LED in OFF state
GREEN LED in ON state
LOW
[In]direction
OUTPUT
GPIO direction
INPUT
6.4.1.4 Blue ON/OFF
This is function used to turn ON/OFF BLUE LED in on board TRI LED by
using GPIO pin.
WyzBeeGpio_Init(port,dir,value)
Parameter
Name
Possible values
Description
[In] port
GPIO_LED4
Tri LED interface:BLUE colour
[In]value
HIGH
BLUE LED in OFF state
BLUE LED in ON state
LOW
[In]direction
OUTPUT
GPIO direction
INPUT
Redpine Signals, Inc. Proprietary and Confidential
Page 84
WyzBee®
User Manual
Version 1.0
6.4.2 OLED Display
OLED library is a C++ class based implementation. WyzBee _oled is the
main class in which all member functions are defined. The following are
the list of member functions within the WyzBee _oledclass.

Chip select

Transfer

Begin

End

SetBitOrder

SetClockDivider

SetDataMode
6.4.2.1 Enable Chip Select
This function is used to enable the oled chip select.
void Oled_Cs_Enable(void)
Parameter Name
Description
[In] none
return value
6.4.2.2 Disable Chip Select
This function will disable the oled chip select.
void Oled_Cs_Disable(void)
Parameter Name
Description
[In] none
return value
6.4.2.3 Transfer Write as single character not as data
This function is used to send and receive the data on oled through SPI
channel.
unsigned char SPI_OLEDClass::transfer(
unsigned char
Parameter Name
Description
[In] tx_char
Data to be sent
Redpine Signals, Inc. Proprietary and Confidential
tx_char)
Page 85
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
return value
Received data
6.4.2.4 Begin
This function is used to initializes the OLED screen SPI channel.
void SPI_OLEDClass::begin(void)
Parameter Name
Description
[In] none
return value
6.4.2.5 End
This function is used to de initialize the OLED screen SPI channel.
void SPI_OLEDClass::end(void)
Parameter Name
Description
[In] none
return value
6.4.2.6 Set Bit Order
This function will sets the SPI oled bit order.
void SPI_OLEDClass::setBitOrder(unsigned char
bit_order)
Parameter Name
Description
[In] bit_order
Bit order
return value
Received data
6.4.2.7 Set Clock Divider
This function is used to sets the SPI clock frequency.
void SPI_OLEDClass::setClockDivider(
unsigned char div_num)
Parameter Name
Description
Redpine Signals, Inc. Proprietary and Confidential
Page 86
WyzBee®
User Manual
Version 1.0
Parameter Name
Description
[In] div_num
Clock divider number
return value
Received data
6.4.2.8 Data Mode
This function is used to sets the SPI OLED data mode.
void SPI_OLEDClass::setDataMode(
unsigned char data_mode)
Parameter Name
Description
[In] data_mode
Data mode
return value
Received data
6.4.3 IR Receiver
IR sensor is connected to MCU port pin configured as GPIO Input pin.
IR library is a C++ class based implementation. IRrecv is the main class
in which all the member functions are derfined. The following are the list
of functions within the IRrecv class.

enableIRIn

resume

decode
6.4.3.1 IRrecv
This is constructorfunction which will be invoked at the time of object
creation.
This function configures MCU port pin as GPIO Input pin
void IRrecv::IRrecv()
Parameter Name
Description
[In] none
return value
6.4.3.2 enableIRin
This function initializes the state machine to Idle state waiting for IR data.
When IR data is received, IR ISR Timer callback function is called to
record the pulse widths of IR data in a buffer.
Redpine Signals, Inc. Proprietary and Confidential
Page 87
WyzBee®
User Manual
Version 1.0
void IRrecv::enableIRIn()
Parameter Name
Description
[In] none
return value
6.4.3.3 Resume
IR data is decoded by decode function.
This function is used to resume the IR state machine after decode
function detects specific HEX value.
void IRrecv::resume()
Parameter Name
Description
[In] none
IR state machine is resumed
return value
6.4.3.4 Decode
This function is used to decode the raw data (pulse width data from
Remote device is recorded in the ISR)
int IRrecv::decode(class decode_results *results)
Parameter Name
Description
[In] results
Pointer variable to the decode_results class
containing raw data.
return value
1 – Data is available
0 - Data is not available
6.4.3.5 IR Interrupt Handler
This function is the ISR (interrupt service routine) for IR receiver which
will be called based on timer interrupt which is programmed to invoke
ISR at every 50us to sample the data at GPIO pin to which IR sensor is
connected.
void Ir_Isr_receive (void)
Parameter Name
Description
[In] none
return value
Redpine Signals, Inc. Proprietary and Confidential
Page 88
WyzBee®
User Manual
Version 1.0
Redpine Signals, Inc. Proprietary and Confidential
Page 89
WyzBee®
User Manual
Version 1.0
7 APPENDIX A
Downloading and Installing Keil IDE
The Open source Keil IDE from ARM is freely available and can be used
for IoT application development. Keil IDE supports both C and C++
languages and does not have any memory size constraint. Keil IDE can
be downloaded from link given below. We strongly recommend ensuring
you are downloading the MDK-ARM V4.74 setup file.
https://www.keil.com/demo/eval/armv4.htm
You need to register yourself to generate the setup file to be downloaded.
Install Keil IDE according to the procedure given below


Start the installer. When any security warning appears. Pleas click
on Run.
The actual installer will pop-up. Please click on next to continue
setup.
In this window the installation folder can be changed. Please click on
Next to keep the default value.
Figure 8: Keil IDE Installation Wizard
Redpine Signals, Inc. Proprietary and Confidential
Page 90
WyzBee®
User Manual
Version 1.0
Click on “I agree to all the terms…”, and then click “Next”.
Figure 9: Keil IDE Installation Accept Terms
It is possible to change the name of the destination folder. Please click on
next to keep it the same.
Figure 10: Keil IDE Folder Selection
Redpine Signals, Inc. Proprietary and Confidential
Page 91
WyzBee®
User Manual
Version 1.0
Please enter your registration details, and click on the “Next” tab.
Figure 11: Keil IDE Registration
Figure 12: Keil IDE Installation
Redpine Signals, Inc. Proprietary and Confidential
Page 92
WyzBee®
User Manual
Version 1.0
Figure 13: Keil IDE installation complete
After the installation please click on Finish after selecting “ULINK Pro...”.
Figure 14: Keil IDE install driver
Redpine Signals, Inc. Proprietary and Confidential
Page 93
WyzBee®
User Manual
Version 1.0
Now, click on “Install” to install ULINK Drivers.
Figure 15: Keil IDE ULINK driver
Installation of Keil uVision IDE is successful, now you can launch yourself
with the hands-on with WyzBee. Sample Application in the next section
elaborates the usability of WyzBee.
Redpine Signals, Inc. Proprietary and Confidential
Page 94
WyzBee®
User Manual
Version 1.0
8 APPENDIX B
Downloading and Installing CoIDE
The Open source CoIDE from Coocox is freely available and can be used
for IoT application development. CoIDE supports both C and C++
languages and does not have any memory size constraint. CoIDE can be
downloaded from link given below.
http://www1.coocox.org/Tools/CoIDE-1.7.7.exe
Install CoIDE according to the procedure given below


Start the installer. When any security warning appears. Pleas click
on Run.
The actual installer will show. Please click on next to continue
setup.
In this window the installation folder can be changed. Please click on
Next to keep the default value.
Figure 16: CoIDE Installation Wizard
It is possible to change the name of the start folder. Please click on next
to keep it the same.
Redpine Signals, Inc. Proprietary and Confidential
Page 95
WyzBee®
User Manual
Version 1.0
Figure 17: CoIDE Installation Path Selection
Now CoIDE is ready for installation. Please click on Install to start the
installation.
Figure 18: CoIDE Installation Procedure
After the installation is finished please click on Finish.
Windows CoIDE Patch Installation
Redpine Signals, Inc. Proprietary and Confidential
Page 96
WyzBee®
User Manual
Version 1.0
Download and install the CoIDE patch for the Windows from the following
link:
http://www1.coocox.org/Tools/CoIDE-1.7.8-Patch-For-1.7.7.exe
Windows CoIDE GCC Tool chain Installation
The latest version of CoIDE doesn't have the GCC compiler integrated
anymore, download and install GCC tool chain for the Windows from the
following link:
https://launchpad.net/gcc-arm-embedded/4.8/4.8-2014-q2update/+download/gcc-arm-none-eabi-4_8-2014q2-20140609-win32.exe
After downloading the Toolchain we are supposed to select the toolchain
path from the CoIDE, for debugging any project.
For this please go to „Project‟ menu and click on „Select Toolchain Path‟,
and give your path for the GCC toolchain as shown.
WyzBee device configuration on CoIDE
For configuring WyzBee in CoIDE following is the procedure:

Click on the „Configuration‟ button.

Now make sure all the fields in each section match the figures below.
The device selection should match the above figure.
Redpine Signals, Inc. Proprietary and Confidential
Page 97
WyzBee®
User Manual
Version 1.0
Make sure Compile section matches above figure.
Make sure Link section matches above figure.
Redpine Signals, Inc. Proprietary and Confidential
Page 98
WyzBee®
User Manual
Version 1.0
Make sure the Output section matches above figure.
Make sure the User section matches above figure.
Make sure the Debugger section matches above figure.
Redpine Signals, Inc. Proprietary and Confidential
Page 99
WyzBee®
User Manual
Version 1.0
Make sure the Download section matches the above figure.
Redpine Signals, Inc. Proprietary and Confidential
Page 100
WyzBee®
User Manual
Version 1.0
9 APPENDIX C
Downloading and installing IAR
IAR Embedded Workbench is a development environment that
includes a C/C++ compiler and debugger that supports 30 different
processor families. IAR can be easily used to design WyzBee applications.
Here we will be discussing about downloading and installing IAR.
User can download the setup file for IAR Embedded Workbench from:
http://netstorage.iar.com/SuppDB/Protected/PRODUPD/009949/EWARMCD-7401-8472.exe
User can follow the steps shown below to register and install the IAR
EWARM.
Double click the .exe file a window appears click on the second option as
shown.
Then click on „Next‟ for going further as shown.
Redpine Signals, Inc. Proprietary and Confidential
Page 101
WyzBee®
User Manual
Version 1.0
Now, check the „I accept…‟ box and click on Next.
Now, select the location for installation and click Next.
Select the name of the installation folder and click Next.
Redpine Signals, Inc. Proprietary and Confidential
Page 102
WyzBee®
User Manual
Version 1.0
Now, click on Install to start installation.
Installation window appears, wait for the installation.
Redpine Signals, Inc. Proprietary and Confidential
Page 103
WyzBee®
User Manual
Version 1.0
After the installation is complete, it would ask to remove all the dongles
from the system. User is supposed to do so, and click on Yes.
Redpine Signals, Inc. Proprietary and Confidential
Page 104
WyzBee®
User Manual
Version 1.0
This will start the driver installation for USB. Following window will
appear.
After this installation, a window saying „Installation Wizard Complete‟
shall appear, click on Finish.
Redpine Signals, Inc. Proprietary and Confidential
Page 105
WyzBee®
User Manual
Version 1.0
It would ask to install some softwares for IAR. Install them
Select your language and click on OK.
This completes the installation part of IAR Embedded Workbench and
opens the application as shown in the picture below
Redpine Signals, Inc. Proprietary and Confidential
Page 106
WyzBee®
User Manual
Version 1.0
Then it opens a License Wizard asking for registration, do as directed in
the following figures.
Redpine Signals, Inc. Proprietary and Confidential
Page 107
WyzBee®
User Manual
Version 1.0
Redpine Signals, Inc. Proprietary and Confidential
Page 108
WyzBee®
User Manual
Version 1.0
Clicking Register takes the user to a web browser for registration. Select
the „Code Size Limited‟ option and give your details for registration.
After Submitting the register details a page asking for a confirmation mail
appears. Open the email provided during registration and click on the
confirmation link.
Redpine Signals, Inc. Proprietary and Confidential
Page 109
WyzBee®
User Manual
Version 1.0
Once confirmed, a page appears with a License Key which needs to be
provided on the License Wizard. Copy the key and paste it on that
window and click Next.
Clicking Next will confirm the License key and Registration process and
user can launch into the IAR for exploring WyzBee.
Redpine Signals, Inc. Proprietary and Confidential
Page 110
WyzBee®
User Manual
Version 1.0
WyzBee device configuration on IAR
For configuring WyzBee device in IAR following steps should be followed.

Go to „Project‟ and click on „Options‟. See below
Redpine Signals, Inc. Proprietary and Confidential
Page 111
WyzBee®
User Manual
Version 1.0

Follow the figures shown below and the steps shown in them.

Steps are defined below:
1. Navigate to Debugger.
2. Select tab „Setup‟.
3. Select driver „CMSIS-DAP‟.

Now follow the below figure:
Redpine Signals, Inc. Proprietary and Confidential
Page 112
WyzBee®
User Manual
Version 1.0

Steps are defined below:
4. Select in „CMSIS-DAP‟.
5. Select „JTAG/SWD‟.
6. Select SWD.
Redpine Signals, Inc. Proprietary and Confidential
Page 113
WyzBee®
User Manual
Version 1.0
10 APPENDIX D
Expansion Header pin mappings on the ARM M4 MCU and
RS9113
Pin Name
Multiplexed Lines
Description
P0
GPIO_12(RS9113)
Generally used for I2S_WS line.
P1
GPIO_11(RS9113)
Generally used for I2S_SCK line.
P2
AN22
Analog Input
TRACED3
P3
TIOB0_2
Input pin for BT ch0 TIOB
SOT7_0
Input pin for MFS ch7 SOT
MCSX3_0
Output for external bus CS3
AN21
Analog Input
TRACED2
TIOA0_2
Input pin for BT ch0 TIOA
SCK7_0
Input pin for MFS ch7 SCK
MCLKOUT_0
Output for external bus clock
AN02
Analog Input
SCK1_1
Input pin for MFS ch1 SCK
IC01_2
Input pin for Input Capture IC01
RTCCO_1
Output for RTC clock
SUBOUT_1
Output for Sub clock divide
MAD09_0
Output for external bus09
RSTD
RESET_N_DAP
Debugger reset
P5
TDO
JTAG function select
P4
SWO
P6
TDI
JTAG function select
MCSX6_0
Output for external bus CS6
Redpine Signals, Inc. Proprietary and Confidential
Page 114
WyzBee®
User Manual
Version 1.0
Pin Name
P7
Multiplexed Lines
TCK
Description
JTAG function select
SWCLK
P8
TMS
JTAG function select
SWDIO
GND
Ground.
CTRL
Power Switch control
RST
MCU_RESET_N
Reset the main MCU
3V3*
3.3V power supply for external peripherals
3V3
Power Supply for wireless module
VOUT
VIN
GND
P20
P19
P18
P17
Ground
TIOB2_1
Input pin for BT ch2 TIOB
SOT3_1
Input pin for MFS ch3 SOT
INT10_1
External Interrupt Line
MADATA09_0
Output data for external bus.
TIOB1_1
Input pin for BT ch1 TIOB
SIN3_1
Input pin for MFS ch3 SIN
INT09_2
External Interrupt Line
MADATA08_0
Output data for external bus.
AN09
Analog Input
SIN4_1
Input pin for MFS ch4 SIN
IC00_1
Input pin for Input Capture IC00
INT05_1
External Interrupt Line
MAD16_0
Output for external bus16
AN03
Analog Input
SIN0_1
Input pin for MFS ch0 SIN
Redpine Signals, Inc. Proprietary and Confidential
Page 115
WyzBee®
User Manual
Version 1.0
Pin Name
P16
P15
P14
P13
P12
P11
Multiplexed Lines
Description
IC02_2
Input pin for Input Capture IC02
INT03_1
External Interrupt Line
MAD10_0
Output for external bus10
TIOA1_2
Input pin for BT ch1 TIOA
SOT4_0
Input pin for MFS ch4 SOT
RTO13_0
Output pin for waveform generator RTO14
MADATA03_0
Output data for external bus.
TIOB1_2
Input pin for BT ch1 TIOB
SIN4_0
Input pin for MFS ch4 SIN
RTO14_0
Output pin for waveform generator RTO14
INT02_0
External Interrupt Line
MADATA04_0
Output data for external bus.
SCK4_0
Input pin for MFS ch4 SCK
ZIN0_2
Input pin for QPRC ch0 ZIN
RTO12_0
Output pin for waveform generator RTO12
MADATA02_0
Output data for external bus.
RTS4_0
Output pin for MFS ch4 RTS
BIN0_2
Input pin for QPRC ch0 BIN
RTO11_0
Output pin for waveform generator RTO11
INT01_0
External Interrupt Line
MADATA01_0
Output data for external bus.
TIOA1_0
Output pin for BT ch1 TIOA.
RTO11_1
Output pin for waveform generator RTO11
INT13_1
External Interrupt Line
TIOA0_0
Output pin for BT ch0 TIOA.
RTO10_1
Output pin for waveform generator RTO10
INT12_1
External Interrupt Line
Redpine Signals, Inc. Proprietary and Confidential
Page 116
WyzBee®
User Manual
Version 1.0
Pin Name
Multiplexed Lines
Description
P10
GPIO_13(RS9113)
Generally used for I2S_DIN line.
P9
GPIO_14(RS9113)
Generally used for I2S_DOUT line.
For more reference user can refer to:
https://www.spansion.com/downloads/fm3_mn706-00040-e.pdf .
Redpine Signals, Inc. Proprietary and Confidential
Page 117
WyzBee®
User Manual
Version 1.0
11 APPENDIX E
WyzBee Board Program/Run Mode Switch
On WyzBee Board one switch is available for placing the ARM Cortex M4
and CMSIS-DAP in Program and Run mode as shown in the below figure:
Figure 19: WyzBee Board Program/Run Mode Switch
Redpine Signals, Inc. Proprietary and Confidential
Page 118
WyzBee®
User Manual
Version 1.0
12 FAQs
12.1 What is the significance of Program (ON) mode switch?
Ans: Generally, the switch is in Run (OFF) mode which enables the user to run
and debug his applications. When in Run mode the WyzBee device is
detected as the CMSIS-DAP Communication Port.
Debugging is not allowed in Program mode. Program mode is generally
used for DAP firmware upgrade, and so a normal user is not encouraged
to change the switch to program mode without any specific goal.
When in Program mode the device is detected as a USB virtual
communication port, as seen in the device manager.
12.2 Why my device manager doesn’t show up the Port name
correctly in my Windows8 system?
Ans: Actually, Windows8 system is digital signature verification enabled, so it
does not allow the CMSIS-DAP driver software to be installed correctly.
User needs to disable this enforcement before installing the CMSIS DAP
driver. Following link describes how to disable a digital signature
enforcement in Windows8 system:
https://learn.sparkfun.com/tutorials/disabling-driver-signature-onwindows-8/disabling-signed-driver-enforcement-on-windows-8
12.3 I am using Keil MDK 5.14 for running the Demo
application on my system but I am unable to do that. Why?
Ans: The application demo provided with this kit is developed on Keil MDK
v4.74 environment. So, it expects the same environment to be tested on,
as there are many dependency changes done in MDK 5.14. For making
the project compatible to MDK 5.14 user should be knowing all the steps
to make the changes.
Redpine Signals, Inc. Proprietary and Confidential
Page 119
WyzBee®
User Manual
Version 1.0
Revision History
Revision
No.
Version
No.
Date
Author
1.1
Dec‟14
Initial Version
1.2
Mar‟15
Edited pictures and
trademark name.
Redpine Signals, Inc. Proprietary and Confidential
Changes
Page 120
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement