Cypress CY3242-IOXlite Getting Started Manual

CY3242-IOXlite
I2C Port Expander Lite Demo Kit
Getting Started Guide
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone (USA): 880.858.1810
http://www.cypress.com
Copyright © 2007 Cypress Semiconductor Corporation. All rights reserved.
PSoC® is a registered trademark and PSoC Designer™, Programmable System-on-Chip™, and PSoC Express™ are trademarks of Cypress Semiconductor Corporation (Cypress), along with Cypress® and Cypress Semiconductor™. All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Throughout this document I2C, IIC and I
2
C are used interchangeably to represent the I2C Communication Protocol trademarked by Philips. Purchase of I2C components from Cypress or one of its sublicensed Associated Companies conveys a license under the Philips I2C Patent Rights to use these components in an I2C system, provided that the system conforms to the I2C Standard Specification as defined by Philips.
The information in this document is subject to change without notice and should not be construed as a commitment by Cypress. While reasonable precautions have been taken, Cypress assumes no responsibility for any errors that may appear in this document. No part of this document may be copied or reproduced in any form or by any means without the prior written consent of Cypress. Made in the U.S.A.
Disclaimer
CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’s product in a life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Flash Code Protection
Cypress products meet the specifications contained in their particular Cypress PSoC Data Sheets. Cypress believes that its family of PSoC products is one of the most secure families of its kind on the market today, regardless of how they are used. There may be methods, unknown to Cypress, that can breach the code protection features. Any of these methods, to our knowledge, would be dishonest and possibly illegal. Neither Cypress nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as "unbreakable."
Cypress is willing to work with the customer who is concerned about the integrity of their code. Code protection is constantly evolving. We at Cypress are committed to continuously improving the code protection features of our products.
2 I2C Port Expander Lite Demo Kit Getting Started Guide
Getting Started with the I2C Port Expander Lite Demo Kit
Associated Project: Yes
Associated Part Family: CY8C9520A
Software Version: PSoC Designer™ V4.3
Associated Application Notes and Kits: AN2352, CY3242-IOX, and CY3240-I2USB
Step 1. Expander Configuration Software Installation
1. Insert CD into CD-ROM drive.
2. Run “ExpanderConfigSetup.exe.”
3. Click the Next button.
I2C Port Expander Lite Demo Kit Getting Started Guide 3
4. Specify software destination. Click the Next button.
5. Select the Start Menu folder. Click the Next button.
4 I2C Port Expander Lite Demo Kit Getting Started Guide
6. Select installation options.
7. Confirm installation settings. If everything is fine, click Install.
I2C Port Expander Lite Demo Kit Getting Started Guide 5
8. Wait until program installation finishes. Click the Finish button.
Installation is complete. The Program icon is located under Start Menu >> Programs >> Cypress MicroSystems… by default.
The remainder of this quick start guide outlines creating an example project, configuring the hardware, setting up and generating a project in the Expander Configuration software, and downloading the project to the target device.
The example project uses the Port Expander CY8C9520 device with I2C address 0x2B. It shows how to obtain two timing signals with frequencies 1 Hz and 4 Hz at pins GP1_0 and GP1_1, respectively. The EEPROM will contain the familiar string, “Hello world!” at address 0x0000.
Step 2. Hardware Configuration
1. Remove the Port Expander Lite demonstration board from the kit box.
6 I2C Port Expander Lite Demo Kit Getting Started Guide
2. Select power source. The demonstration board can be powered by one of three independent power sources: an external 7-14V DC supply via a linear regulator, a regulated 3.3-5V supply by connection to J11, or 5V power supply from a PC via the USB cable. This example will use the third option, which requires J14 to be set in the 2-3 position, as shown in the photo below.
J2-J9
J14
J14 Zoomed In
3. Set I2C Port Expander device address to 0x2B. Use the eight dedicated jumpers, J2-J9, to set the device address. The settings of these jumpers are shown below. Note that the corresponding EEPROM device address is 0x5B.
I2C Port Expander Lite Demo Kit Getting Started Guide 7
4. Be sure that jumper J10 and switch SW2 are set as shown below.
5. Connect the USB cable to the PC and the board as shown below. Once the connection is made, the green LED, D15, will light up. The red power LED, D16, should also light.
SW2
J10
J10 Zoomed In
Hardware configuration is now complete.
Step 3. Software Configuration
1. Open an existing or create a new Expander Configuration software project (the software was installed in Step 1). The software program icon is located under Start Menu >> Programs >> Cypress MicroSystems. To open an existing project, click the menu item File >> Open Project. In the Open Project dialog box select your project and click the Open button.
8 I2C Port Expander Lite Demo Kit Getting Started Guide
Or, to create a new project, click the menu item File >> New Project. In the New Project dialog box specify project location, part type and project name. Click the OK button.
I2C Port Expander Lite Demo Kit Getting Started Guide 9
You will then see a workspace similar to the image below. The I2C Port Expander window shows all internal resources of the target device. The I2C EEPROM window shows an image of the EEPROM data.
2. Set the Port Expander address. To do this, click the I2C Port Expander tab. In the Address Assignment Section (upper-right corner), specify address length and expander address. Note that the EEPROM device address is automatically defined, and not accessible for user editing. Assign address length to 4 pins and define expander address as 0101011 (0x2Bh). The corresponding EEPROM device address is 1011011 (0x5Bh).
10 I2C Port Expander Lite Demo Kit Getting Started Guide
3. Configure Port Expander internal resources. To do this we must generate two output signals on pins P1[0] and P1[1]. The signal frequencies are 1 Hz and 4 Hz, respectively. For this purpose we utilize three PWMs, and two pins and the clock divider resources. Also, the EEPROM must contain the "Hello world!" text string placed at address 0x0000. Follow these steps:
a. Click the PWM Clock Sources on the device image to select it. The relevant resource properties
are shown in the Properties window.
b. Enter DIVIDER value equal to 128. This can be done either in the Properties window or directly on
the DIVIDER space of PWM Clock Sources.
c. Click on the PWM0 resource and define its properties as follows:
Clock: cv_Divider
IntLogic: Falling_Edge
Period: 183
PulseWidth: 91
Note that the Clock, Period and PulseWidth properties can be defined directly in the corresponding areas of PWM0 resource.
d. Click on the PWM1 resource and define its properties as follows:
Clock: cv_PrevPWM
IntLogic: Falling_Edge
Period: 2
PulseWidth: 1
I2C Port Expander Lite Demo Kit Getting Started Guide 11
e. Click on the PWM2 resource and define its properties as follows:
Clock: cv_PrevPWM
IntLogic: Falling_Edge
Period: 2
PulseWidth: 1
f. Select P1[0] and P1[1] pins by holding the [Shift] key down and clicking the corresponding pin
images. Some editing can be done at this time in the Properties window. Configure the selected pin properties as follows:
Data: High
Direction: Output
DriveMode: Strong
Interrupt: Disable
Inversion: Not Checked (Disable)
PinMode: PWM
g. Enable the switch inputs
Select all of the P0[x] pins by dragging a box around them in the window, or by using the <SHIFT> key. Set them all to:
Data: Low
Direction: Input
DriveMode: Pull-down
Interrupt: Disable
Inversion: Not Checked (Disable)
PinMode: GPIO
12 I2C Port Expander Lite Demo Kit Getting Started Guide
h. Turn off the other LEDs
Select all the unused P1[x] and P2[x] pins and set them to:
Data: Low
Direction: Output
DriveMode: Strong
Interrupt: Disable
Inversion: Not Checked (Disable)
PinMode: GPIO
i. Enable the EEPROM
Click on the EEPROM block and set the options using the Properties Window:
EnableEEPROM: Checked
ReadOnly: Unchecked
WriteDisablePin: Unchecked
The result of the Port Expander configuration is shown below:
I2C Port Expander Lite Demo Kit Getting Started Guide 13
4. Define EEPROM image addresses/text string. Click the I2C EEPROM tab. You can type characters in the far right column or HEX digits in the individual HEX columns. See the following:
5. Set configuration script options. To set the options, click the menu item Tools >> Script Generator Options. In the Script Generator Options dialog box (shown below) click a check in all options to generate a full configuration script. Click OK.
14 I2C Port Expander Lite Demo Kit Getting Started Guide
6. Generate configuration script. To generate the configuration script, click the menu item Tools >> Generate Configuration Script File. Once generation is complete, the script is located in the project folder and has the same name as the project and “iic” extension, for example, FirstExpanderProject.iic.
7. Save your project.
Step 4. Download Configuration Script to Target Device
The generated script file can be downloaded to the target device using the download command or using the separate I2C-USB Bridge software, also included in this kit.
Step 4a Download Configuration Using the Expander Configurator GUI
1. Select Download Configuration from the Tools menu, or press the Download button on the toolbar. The Download Window will open.
2. Select the IOXlite target board from the upper box.
3. Select +5V power or External power if the board is powered externally.
4. Select 100k for the IIC speed.
5. Press the Device List button and verify that the port expander device appears in the lower box. The address should show 0x2B and the device type is CY8C9520. (Note that if the device was previously programmed, the EEPROM address may also show up in the list.)
6. Select the port expander device from the lower box and press the Download button.
7. Downloading should proceed without error, the board should reset, and the LEDs on GP1_0 and GP1_1 should begin blinking.
I2C Port Expander Lite Demo Kit Getting Started Guide 15
Step 4b Download Configuration using the I2C-USB Bridge GUI
If this software is not installed, you will need to install it in order to download the script and program the target device. For details, refer to the I2C-USB Bridge Quick Start Guide. Following is a simplified version of the instructions:
1. Run the “I2C-USB Bridge” software program.
2. Select +5V to supply the Port Expander board with power from the bridge board.
16 I2C Port Expander Lite Demo Kit Getting Started Guide
The red and green LEDs on the bridge portion of the board will light up.
Green LED D15
Red LED D16
3. Click the
button and make sure that the corresponding device (CY8C9520) with address
0x2B is connected.
4. Click the
button. Load the .iic file you created in the last step.
5. Click a check in the "Send all strings" field.
6. Click the Send button.
I2C Port Expander Lite Demo Kit Getting Started Guide 17
Step 5. Your first project is finished.
If everything was done correctly, there will be 1 Hz and 4 Hz frequencies on pins P1[0] and P1[1] and the corresponding LEDs should be blinking. Also, the EEPROM will contain the "Hello World!" string. This can be verified using the I2C-USB Bridge GUI by sending the following command strings.
;Read from EEPROM sB6 00 00 ;Set EEPROM address to start reading sB7 x ;repeat this line to read each byte
The switch operation can be verified using the following command strings.
;Read switches s56 00 ;start reading s57 x ;repeat this line to read the switch state
18 I2C Port Expander Lite Demo Kit Getting Started Guide
I2C Port Expander Lite Demo Kit Getting Started Guide 19
Loading...