AN2352 Cypress, AN2352 Datasheet - Page 2

no-image

AN2352

Manufacturer Part Number
AN2352
Description
I2C USB Bridge Usage
Manufacturer
Cypress
Datasheet
www.DataSheet4U.com
7.
Implement I
A tool that can continuously collect and display variable
values is very useful during debugging/testing PSoC-
based projects. Reading measurement results, pin states
and dynamic modification of device properties are tasks
commonly performed by designers. The UART User
Module is frequently used for such tasks. But such a
method contains several disadvantages:
Taking into account everything mentioned above, using an
I2C-USB bridge is more suitable and cheaper than other
solutions.
To implement the I
the following steps are required:
9/22/2006
Click the List button in the USB2IIC.exe program.
The list of all connected I
that if the bridge is providing power, it is necessary to
turn the power on before the List button will work.
The design requires one spare digital PSoC block for
half-duplex UART operation. (The I
hardware is independent of the digital blocks.)
Some computers, particularly notebooks, do not have
COM ports and communication capabilities for a
UART. A USB-UART bridge is needed.
The additional level-bridge, such as a MAX232, is
necessary on the designed board.
The bandwidth of an I2C-USB bridge is greater than
the bandwidth of a standard UART. The maximum
bandwidth for a UART is about 11 kB/s, but I2C-USB
bridge can attain a 25kB/s bandwidth.
Place the EzI2Cs User Module in the PSoC project.
Set the following User Module Parameters:
o
o
o
o
o
2
Slave_Addr to 1 (this address can be
almost anything, it is not restricted to 1)
Address_Type to Static
ROM_Registers, in most cases, to
Disable
I
I
2
2
C Interface into PSoC
2
C Clock to 400 kHz Fast
C Pins to P1[0]-P1[1] or P1[5]-P1[7]
C slave interface into a PSoC project,
2
C devices will appear. Note
2
C interface
Figure 1. I2C-USB Bridge
Revision **
Now designers can work with all listed devices.
struct I2C_Regs {
} MyI2C_Regs;
EzI2Cs_SetRamBuffer(cI2CREAD,cI2CWRITE,(BYTE
*)&MyI2C_Regs);
EzI2Cs_Start();
Once the above steps are complete, there is no additional
code required to support I
User Module works in the background with I
handlers.
The first byte received by I
buffer from where data will be read from or written to.
Default offset is 0. There is one aspect that should be
considered when working with the I
the variable going into the buffer is greater than 1 byte, a
special technique must be used. First, always disable the
interrupt before changing or reading this variable in the
program. Second, verify the permissibility of variable
access. To implement this, the program must analyze the
EzI2Cs bRAM_RWcntr variable. This variable points to
current transmission index of the I
analysis, the situation depicted in Figure 2 can occur.
WORD wX1;
int iADC;
BYTE bStatus;
Define the RAM buffer that will contain data required
for I
whose address will be specified when the
SetRamBuffer function is called. For example:
Insert, into the initialization part of program, the
following two strings:
Set the arguments of EzI2Cs_SetRamBuffer function
to proper values. Length of data, which could be read,
is set by cI2CREAD argument and length of data,
which could be written, is set by cI2CWRITE. The
address of the I
is the third argument.
2
C transmission. Define the array or structure
2
C buffer is set by MyI2C_Regs, which
// Example I2C interface structure
// read/write value
// read only value
// read only value
2
C communication. The EzI2Cs
2
C slave is the offset into the
2
2
C buffer. Without such
C buffer. If the size of
2
C interrupt
AN2352
- 2 -

Related parts for AN2352