Anda di halaman 1dari 3

Lab

My first PSoC4 program

Learning goals:
1.
2.
3.
4.
5.

Create a bootloadable project


Read data sheets
Use output pins
Use off chip components for documentation purposes
Write a small program that blinks a led

In this exercise you will create a PSoC4 project with PSoC Creator and load your project onto the prototype
board using UART boot loader.
CY8CKIT-049-42xx prototyping kit comes with a preinstalled UART boot loader. The kit contains two parts:
USB serial converter board which is the smaller part of the prototyping board and the PSoC4 board which is
the larger part of the board. The PSoC4 can be programmed using PSoC Creators Boot loader host tool
which in turn uses the USB serial converter to connect to the PSoC.
Boot loader is a small piece of software that is run when the board is powered up. The boot loader checks
whether you want to start an existing application or to program a new application. A program running on a
CPU with boot loader is not located at the default reset address of the CPU. The compiler needs to know at
which address the code should be located when a program is compiled. Our prototype board comes with a
preprogrammed boot loader and we need to tell the compiler the address at which the boot loader writes
the programs that are downloaded to the board. That is done by adding bootloadable component to our
schematic. Then we add a reference to the existing boot loader in the bootloadable configuration. PSoC
Creator extracts the address information from the boot loader reference and passes the information to the
compiler.
First create a bootloadable project. A link to video instructions on creating a project can be found in Tuubi.
The video is called CreateProject.wmv. Before creating your project download Dependencies.zip from
Tuubi. The video will give you instructions what to do with the zip file. Remember to build your project
before adding other components to verify that your project was created and configured properly. It is much
easier to fix project configuration issues at this point.

When your project has been successfully created then add output pin and control register that are used to
control an onboard led. Output pin will be linked to a pin on the CPU chip (P1.6) and control register
provides the value that is driven out of the pin. The video instructions on adding the pin and documenting
the external components can be found in a video called GpioLed.wmv.

When all your components are in place all you need to do is to read data sheet of control register to learn
how set values to output pins and write a little program that will blinks the led with the following sequence
in an infinite loop:
1.
2.
3.
4.
5.
6.

100 ms on
900 ms off
100 ms on
200 ms off
100 ms on
900 ms off

To create a delay you can use CyDelay() function.


When your program is ready for testing you need to download it to the board. The onboard boot loader is
activated by pressing and holding the button while inserting the board into USB port. The board should be
displayed as a serial port.
To start programming tool select Tools Bootloader Host from the menu. In the bootloader host first
select the file that you want to download. The file is located in
<your lab directory>\<project>\<project >.cydsn\CortexM0\ARM_GCC_473\Debug\<project>.cyacd

Then select the com port of your device, configure speed and press program (the button with a blue
arrow).
Ask instructor to check that your program works correctly.

Anda mungkin juga menyukai