EZ-USB STARTUP CODE
Applies to: C51 C Compiler
Answer
Information in this article applies to:
- C51 Version 5.50a
- C51 Version 6.00
QUESTION
I can't get my EZ-USB application to work when I program it into
an external EPROM device. Weird problems occur that I can't figure
out. What's wrong?
ANSWER
The Cypress EZ-USB development board provides you a way to easily
get started with USB. However, because of the large number of
different configuration options, you may have some difficulty getting
your own applications and hardware to work.
Following are a few tips that may help:
-
Include the STARTUP.A51 from the c51lib directory in your
project. You may need to modify this file to initialize your
XDATA.
-
Modify the startup code to include the configuration for Ports
A, B, and C. Since these ports control the RD and WR lines, if they
are incorrectly configured, your external XDATA probably won't
work. Since the startup code clears XDATA and the init code
initializes your global variables (even the ones in XDATA), the RD
and WR lines must be setup beforehand. Don't initialize these ports
in your main C function.
-
Reserve the space in XDATA that is used for the USB registers.
Make sure that you don't accidentally place variables in this
memory area. These XDATA registers are used by the EZ-USB chip for
the USB buffers. You can reserve ALL of this space with the
following code:
unsigned char code USB_1 [0x4C0] _at_ 0x1B40;
unsigned char code USB_2 [0x4C0] _at_ 0x7B40;
Article last edited on: 2005-07-09 11:08:12
Rate this article
Disagree? Move your mouse over the bar and click