Cypress Semiconductor CY8CKIT-142, CY5671 Users Manual

5.2 BLE Module Board
5.2.1 PSoC 4 BLE or PRoC BLE
The PRoC BLE or PSoC 4 BLE is the main component on the BLE Module. It provides the RF interface and analog and digital capability. The PRoC BLE or PSoC 4 BLE pins are mapped to the Bluetooth module headers (see Figure 5-20). For more information, refer to the BLE web page.
Figure 5-20. Schematics and Board Highlight of Bluetooth Module Headers for BLE Pins
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 106
5.2.2 Bluetooth Module Headers (20-Pin and 24-Pin Headers)
Analog Pins
Digital Pins
P3.7P3.6 P3.5P3.4 P3.3P3.2
P3.1P3.0 P5.1P4.0 P5.0P4.1 P2.7P2.6 P2.5P2.4 P2.3P2.2 P2.1P2.0
P1.7 P1.5 P1.3
P0.5 P0.3 P0.1
P0.4 P0.2 P0.0
P1.6
/XRES
P1.0
P1.1 P1.2
P1.4
P0.7 P0.6
VDDA
VDDR
VDDD
VREF
J2
HEADER 10x2
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16 17 18 19 20
TP2
RED
TP1
RED
TP5
BLACK
TP3 RED
TP4
RED
J1
HEADER 12x2
1 2
3 4
5 6
7 8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
The PSoC 4 BLE and PRoC BLE Modules connect to the Pioneer board using the two (20-pin and 24-pin) Bluetooth module headers (Figure 5-21). All GPIOs and power domains are brought out to these headers. These headers are the counterparts of the connectors in section 5.1.4.
Figure 5-21. Schematics and Board Highlight of Headers
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 107
5.2.3 Wiggle Antenna
Both the modules use the wiggle antenna. Refer to the Antenna Design Guide ( AN91445) for details. Figure 5-22. Board Highlight of Wiggle Antenna
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 108
5.2.4 Antenna Matching Network
An Antenna Matching Network is required between the BLE device and the antenna to achieve opti­mum performance (Figure 5-23). The matching network has four main tasks:
Transform the balanced output of the radio to an unbalanced connection to the antenna (balun).
Transform the output impedance of the ra dio to a 50-ohm antenna.
Suppress harmonics to a level below the regulations lev el in TX mod e.
Suppress the local oscillator (LO) leakage in RX mode.
Figure 5-23. Schematics and Board Highlight of Antenna Matching Network and Antenna
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 109
5.2.5 BLE Passives
SAR bypass
CMOD
Shunt Resistor
C_Tank
No Load
No Load
P4.0 P4.1
VDDD
VDDA
VDDR
VREF
VCCD VDDD
0603
C20
1.0 uF
0402
C9
0.1 uF
0603
C10
1.0 uF
0603
C2
1.0 uF
0402
C1
0.1 uF
C22
10000 pF
0603
C6
1.0 uF
0603
C17
1.0 uF
0603
C4
1.0 uF
0402
C5
0.1 uF
0402
C16
0.1 uF
0402
C3
0.1 uF
0603
C8
1.0 uF
C21 2200 pF
0603
C19
1.0 uF
0603
C15
1.0 uF
0402
C18
0.1 uF
0805
R1
Zero Ohm
0805
R2
Zero Ohm
0603
C12
1.0 uF
0402
C11
0.1 uF
0402
C7
0.1 uF
Module boards include a 24-MHz cryst al and a 32-kHz crysta l, the CMOD and shield (CT ANK) circuit for CapSense, a SAR bypass capacitor, and adequate decoupling capacitors for all the power domains, as shown in Figure 5-24.
Figure 5-24. Schematics and Board Highlight of External Crystal, CMOD, CT ANK, Decap s, Jumpers
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 110
Hardware
5.2.6 Test Points
All power domains are brought out as test points for easy probing.
5.3 BLE Dongle Board
See PSoC 4 BLE or PRoC BLE on page 106. See Wiggle Antenna on page 108. See Antenna Matching Network on page 109. See Pioneer Board LEDs on page 101. See Push Buttons on page 102. Figure 5-25. Board Highlight
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 111
5.3.1 Power System
USB
USB
5V
PTC
ESD
Protection
PRoC
PSoC5LP
5V
5V
Headers
The board is powered directly using 5 V from the USB port, as shown in Figure 5-26. Figure 5-26. Power Supply Block Diagram With Protection Circuits
5.3.1.1 Protection Circuits
The PTC resettable fuse is connected to protect the computer's USB ports from shorts and overcur­rent.
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 112
5.3.2 USB Type A Plug
The PSoC 5LP connects to the USB port of a PC through a USB type A plug (Figure 5-27). This plug can also be used to power the board. A resettable polyfuse is used to protect the computer's USB ports from shorts and overcurrent. If more than 500 mA is applied to the USB port, the fuse will auto­matically break the connection until the short or overload is removed. The VBUS, D+, and D– lines from the USB connector are also protected again st ESD eve n ts using TVS diod es.
Figure 5-27. Schematics and Board Highlight of USB Ty pe A Plug
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 113
5.3.3 User LED
BLE_STATUS
0805
R7
820 ohm
0805
LED1
Status LED Blue
2 1
A user LED is provided to indicate status from the PRoC BLE device (Figure 5-28). It is also used to show the bind status.
Figure 5-28. Schematics and Board Highlight of User LED
Hardware
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 114
6. Advanced Topics
This chapter describes advanced features of the BLE Pioneer kit as well as the corresponding projects. It can be used as referenc e to exploit these features for other applications, according to project requirements.
6.1 Using PSoC 5LP as USB-UART Bridge
The PSoC 5LP serves as a USB-UART bridge, which can communicate with the COM terminal software. This section explains how to create a PSoC 4 BLE code example to communicate with the COM terminal software.
Users who have a Windows operating system that does not have HyperTerminal can use an alternative terminal software such as PuTTY.
1. Create a new PSoC 4 BLE project in PSoC Creator, as shown in Figure 6-1. Select an appropriate location for your project and rename the project as required.
Figure 6-1. Create New Project in PSoC Creator
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 115
2. Drag and drop a UART (SCB) component (Figure 6-2) to the TopDesign.
Figure 6-2. UART Component in Component Cat alog
Advanced Topics
3. To configure the UART, double-click or right-click the UART component and select shown in Figure 6-3.
Figure 6-3. Open UART Configuration Window
Configure, as
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 116
Advanced Topics
4. Change the instance name to UART. Configure the UART as shown in Figure6-4, Figure 6-5, and Figure 6-6. Click
OK.
Figure 6-4. UART Configuration Tab Window
Figure 6-5. UART Basic Tab Window
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 117
Figure 6-6. UART Advanced Tab Window
Advanced Topics
5. Select P1[4] for UART RX and P1[5] for UART TX in the shown in Figure 6-7.
Figure 6-7. Pin Selection
Pins tab of <Project_Name>.cydwr, as
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 118
Advanced Topics
6. Place the following code in your main.c project file. The code will echo any UART data received.
int main()
{ uint8 ch;
/* Start SCB UART TX+RX operation */ UART_Start();
/* Transmit String through UART TX Line */
UART_UartPutString("CY8CKIT-042-BLE USB-UART");
for(;;) { /* Get received character or zero if nothing has been received yet
*/
ch = UART_UartGetChar();
if(0u != ch) { /* Send the data through UART. This function is blocking and waits until
there is an entry into the TX FIFO. */
UART_UartPutChar(ch); } }
}
7. Build the project by clicking Build > Build {Project Name} or [Shift][F6]. After the project is built without errors and warnings, program (by choosing
Debug > Program) the project to PSoC 4
BLE/PRoC BLE through the PSoC 5LP USB programmer or MiniProg3.
Note: UART RX and UART TX can be rou ted to any digit al p in on PSoC 4 BL E/PRoC BLE based
on the configuration of the UART component. An SCB implementation of UART will route the RX and TX pins to one of the following subsets: (P0[0], P0[1] or P0[4], P0[5] or P1[4], P1[5] or P3[0], P3[1] or P3[4], P3[5] or P5[0], P5[1]).
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 119
To communicate with the PSoC 4 from the terminal software, follow this procedure:
1. Connect USB mini-B to J13. The kit enumerates as a
KitProg USB-UART and is available in the Device Manager, Ports (COM & LPT). A communication port is assigned to the KitProg USB-UART, as shown in Figure 6-8.
Figure 6-8. KitProg USB-UART in Device Manager
Advanced Topics
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 120
Advanced Topics
HyperTerminal
PuTTY
2. Open HyperTerminal and choose File > New Connection and enter a name for the new connection and click select
Serial under Connection.
OK, as shown in Figure 6-9. For PuTTY, double-click the PuTTY icon and
Figure 6-9. Open New Connection
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 121
Advanced Topics
HyperTerminal
PuTTY
3. A new window opens, where the communication port can be selected. In HyperTerminal, select COMx (or the specific communication port that is assigned to the Kit-
Prog USB-UART) in COMx in
Serial line to connect to. This code example uses COM12.
Connect using and click OK, as shown in Figure 6-10. In PuTTY enter the
Figure 6-10. Select Communication Port
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 122
Advanced Topics
HyperTerminal
PuTTY
4. In HyperTerminal, select Bits per second, Da ta bi ts, Parity, Stop bits, and Flow control under
Port Settings and click OK, as shown in Figure 6-11. Make sure that the settings are identical to
the UART settings configured for the BLE device. In PuTTY select
the serial line
communication port (COM12) and
Speed (baud), Data bits, Stop bits, Parity and Flow control under Configure
. Click Session and select Serial under Connection type. Serial line shows the
Speed shows the baud rate selected. Click Open to start the
communication.
Figure 6-11. Configure the Communication Port
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 123
Advanced Topics
5. Enable Echo typed characters locally in File > Properties > Settings > ASCII Setup, to display the typed characters on HyperTerminal, as shown in Figure 6-12. In PuTTY, select
on
in T erminal > Line discipline options to display the typed characters on PuTTY, as shown in
Force
Figure 6-13.
Figure 6-12. Enable Echo of Typed Characters in HyperTerminal
Figure 6-13. Enabling Echo of Typed Characters in PuTTY
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 124
Advanced Topics
6. The COM terminal software displays both the typed data and the echoed data from the PSoC 4 BLE or PRoC BLE UART, as shown in Figure 6-14 and Figure 6-15.
Figure 6-14. Data Displayed on HyperTerminal
Figure 6-15. Data Displayed on PuTTY
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 125
6.2 Using PSoC 5LP as USB-I2C Bridge
Advanced Topics
The PSoC 5LP serves as a USB-I2C bridge that can be used to communicate with the USB-I2C software running on the PC. The following step s describe how to use the USB-I communicate between the BCP and the PSoC 4 BLE/PRoC BLE.
1. Create a new project targeting the PSoC 4 BLE/PRoC BLE dev ice in PSoC Creator, as shown in
Figure 6-16.
Figure 6-16. Create New Project in PSoC Crea tor
2
C bridge, which can
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 126
2. Drag and drop an I2C component (Figure 6-17) to the TopDesign.
2
Figure 6-17. I
C Component in Component Catalog
Advanced Topics
3. To configure the I
ure
, as shown in Figure 6-18.
Figure 6-18. Open I
2
C component, double-click or right-click the I2C component and select Config-
2
C Configuration Window
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 127
Advanced Topics
4. Change the instance name to I2C. Configure the I2C component according to the settings in
Figure 6-19 and Figure 6-20 and click
OK.
Figure 6-19. Configuration Tab
Figure 6-20. I
2
C Basic and Advanced Tabs
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 128
Advanced Topics
5. Select pin P3[5] for the I2C SCL and pin P3[4] for the I2C SDA in the Pins tab of
<Project_Name>.cydwr, as shown in Figure 6-21.
Figure 6-21. Pin Selection_USBI2C
6. Place the following code in your BLE device to transmit and receive I
main.c project file. The code will enable the PSoC 4 BLE/PRoC
2
C data to and from the BCP application.
int main()
{
2
uint8 wrBuf[10]; /* I uint8 rdBuf[10]; /* I
C write buffer */
2
C read buffer */
uint8 indexCntr; uint32 byteCnt;
/* Enable the Global Interrupt */
CyGlobalIntEnable;
2
/* Start I
C Slave operation */
I2C_Start();
/* Initialize write buffer */
I2C_I2CSlaveInitWriteBuf((uint8 *) wrBuf, 10);
/* Initialize read buffer */
I2C_I2CSlaveInitReadBuf((uint8 *) rdBuf, 10);
for(;;) /* Loop forever */
{
/* Wait for I
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 129
2
C master to complete a write */
Advanced Topics
if(0u != (I2C_I2CSlaveStatus() & I2C_I2C_SSTAT_WR_CMPLT))
{
/* Read the number of bytes transferred */
byteCnt = I2C_I2CSlaveGetWriteBufSize();
/* Clear the write status bits*/
I2C_I2CSlaveClearWriteStatus();
/* Move the data written by the master to the read buffer so that the
master can read back the data */
for(indexCntr = 0; indexCntr < byteCnt; indexCntr++)
{
rdBuf [indexCntr] = wrBuf[indexCntr]; /* Loop back the data to the read
buffer */
}
/* Clear the write buffer pointer so that the next write operation will
start from index 0 */
I2C_I2CSlaveClearWriteBuf();
/* Clear the read buffer pointer so that the next read operations starts
from index 0 */
I2C_I2CSlaveClearReadBuf();
}
/* If the master has read the data , reset the read buffer pointer to 0
and clear the read status */
if(0u != (I2C_I2CSlaveStatus() & I2C_I2C_SSTAT_RD_CMPLT))
{
/* Clear the read buffer pointer so that the next read operations starts
from index 0 */
I2C_I2CSlaveClearReadBuf();
/* Clear the read status bits */
I2C_I2CSlaveClearReadStatus();
}
}
}
7. Build the project by choosing Build > Build Project or [Shift] [F6]. After the project is built without errors and warnings, program (
[Ctrl] [F5]) this code onto the PSoC 4 BLE/PRoC BLE
through the PSoC 5LP programmer or MiniProg3.
8. Open the BCP from
number>
9. Connect to
.
KitProg/ under Connected I2C/SPI/RX8 Ports, as shown in Figure 6-22.
Start > All Programs > Cypress > Bridge Control Panel <version
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 130
Figure 6-22. Connecting to KitProg/ in BCP
Advanced Topics
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 131
Advanced Topics
10.Open Protocol Configuration from the Tools menu and s elect the appropriate I2C Speed, as shown in Figure 6-23. Make sure the I component. Click
OK to close the window.
2
C speed is the same as the one configured in the I2C
Figure 6-23. Opening Protocol Configuration Window in BCP
11. From the BCP, transfer five bytes of data to the I command shown in Figure 6-24 and press
[Enter] or click the Send button in the BCP. The log
2
C device with slave address 0x08. Type the
shows whether the transaction was successful. A '+' indication after each b yte indicates that the transaction was successful and a '–' indicates that the transaction was a failure.
Figure 6-24. Entering Commands in BCP
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 132
Advanced Topics
12.From the BCP, read five bytes of data from the I2C slave device with slave address 0x08. The log shows whether the transaction was successful, as shown in Figure 6-25.
Figure 6-25. Read Data Bytes from BCP
Note: Refer to Help Contents under Help in BCP or press [F1] for details of I
2
C commands.
CY8CKIT-042-BLE Bluetooth® Low Energy (BLE) Pioneer Kit Guide, Doc. # 001-93731 Rev. *A 133
Loading...
+ 65 hidden pages