Software Download Page - Be sure to select the correct model and download the stable release
Note: The model I ordered from Newark did not come with probes, so I ordered RioRand 2-Pack PP150 100 MHz Oscilloscope Clip Probes off Amazon
Allows for Analog and Digital Circuitry in the same chip! Referred to as a true mixed signal dev kit
Chip vs Development Kit Distinction
- The development kit is the entire black electronic board, referred to as the CY8CKIT-059
- The chip is ON the board and is the large black square near the cypress logo directly under the chip name, which is CY8C5888LTI-LP097
The chip is not a fixed design meaning you get to wire the analog and digital components as you see fit
- Analog, op amps, comparators, and sample & hold etc
- Digital, timers and counters etc.
The CY8C5888LTI-LP097 is like an FPGA but with analog circuitry support too
The inspiration behind this section is because my bonehead could not grasp why my pc wasn't detecting the dev kit on plugging in the board using a micro-usb cable.
The Cypress CY8CKIT-059 PSoC MCU comes with TWO usb connectors.
- The KitProg USB Programmer/Debugger
- The Target Board USB (PSoC 5LP's Native USB)
USB on the left of the diagram and another USB on the right.
Onboard programmer/debugger, enables programming and debugging the target PSoC 5LP device.
- Can act as a USB-UART & UART-I2C bridge as well
- Leverages these protocols to communicate with the PSoC project via your computer
- Can be snapped off an used to program other devices that implement the same interface
This is the connector that gets plugged into your computer to detect it and flash your code!
Provides access to the USB block of the PSoC 5LP Device. This connector allows for development of USB applications
- Directly connected to the PSoC 5LP's internal USB Block, meaning you can do cool things like program the PSoC to asct as a USB HID mouse, Keyboard, or other custom USB device!
- When you connect this usb port, your computer likely will just detect a generic device. It is
up to the developer to program the board with firmware that implements a specific USB device class
- CDC (serial) device
- HID Device
- etc etc.
- The Kitprog, when connected can supply 5V to itself, and the target board, i.e the PSoc MCU
- The Target Board USB (micro-usb) can supply 5V to itself, but does not supply the Kitprog at all
Software Download Page - Software can be used without creating an account :)
Workspace Vs Project
- Workspace refers to a small file that just points to different projects
- Project contains all the files that are necessary to build your design
LHS gives you a menu of various things such as
- Schmatics for your project (of which there could be various)
- Design Wide Resources
- Source files (main.c etc etc)
- Header files
RHS give you a menu of components that you can use in your schematic design, both on-chip and off-chip
- Analog Components
- Digital Components
- Filters
- Ports & Pins
- etc etc.
Green wire == Digital Pin
Yellow Orange wire == Analog Pin
Inputs should always be connected to a signal, never leave them undefined regardless of MCU family
Simple Ex:
- Drag and drop a Digital output pin from the on-chip component catalog
Note : The default name is arbitrary, it does not necessarily refer to the physical pin on the chip
- Rename to something that makes sense and use a naming convention
- Ex: If I drag and drop an output pin that I intend to connect to
Port 0 bit 3, I will name isP0_3 - Names cannot use spaces or certain special characters
- Ex: If I drag and drop an output pin that I intend to connect to
- Now that the name reflects what the pin should represent, go to pins tab under Design Wide Resources on the
LHS and use the pull-down menu to select the corresponding (GPIO) pin
- Chip Pin shown on the chip image is different from the Port and Bit
Library of routines that you can call at will from your program
PSoC Creator provides routines such as the CyDelay() function for all projects. Other routines are provided "as needed", depending on your schematic contents
Start(): Analogous to a "power-on" function
writeCounter(uint8 counter): Sets counter to the specified unsigned 8-bit integer
- The counter can also be configured under the schematic tab right clicking the component and configuring
ReadCounter(): Wonder what this does??
WritePeriod(uint8): Period refers to the max value/start value when the counter begins
- This overwrites the default preconfigured values set in the schematic component
- Counter is default configured to count down
There are two types of counters
- Fixed Function counters can only count down
- UDB counters offer more flexibility
- Add Counter to Schematic
- Connect Logic Low to Reset
- Connect a Clock (default is 12MHz but can be changed) to the counter clock pin
- Upper left of Workspace explorer, click on "generate application" which will examine the schematic and create APIs for the placed components
- In Workspace Explorer, you wil now see
Generated_Sourcefolder that holds the C files related to the schematic components Generated_Source/cy_bootwill contain system wide function calls that are useful but not necessarily related to a specific component on your schematic- The delay function will likely be the most useful
ALL components (with exception of pins) require that you call their start() function. If it is not called,
your component will literally do nothing.
#include "project.h"
uint8 count1;
int main(void)
{
CyGlobalIntEnable; /* Enable global interrupts. */
Counter_1_Start(); /* Initialize counter */
for(;;)
{
count1 = Counter_1_ReadCounter();
}
}Why do we initialize count1 outside of main?
- This makes count1 a static variable which comes with many desirable traits
- Static variables are assigned a permanent place in RAM
- These variables are always visible to the debugger
Allows developer to start and stop code execution
- When stopped, we can read values of the local and global variables
- When stopped, you can alter the values of local and global variables
NOTE: Does not allow for inspection/alterations while the code is executing
- Motion control systems cannot be stopped, otherwise the machine will run away
We tackle real-time inspection of embedded systems using an Oscilloscope
- Typically done by writing a
0or1to an output pin - Connecting that pin to an oscilloscope
- Compare that to when other inputs change giving vital timing readings to further debug
Or
- Write a pulse to an output pin
- The width of the pulse indicates where you are in the code
Test_Point_P3_2_Write(1); // Timing marker
CyDelayUs(1); // 1 Microsecond delay
Test_Point_P3_2_Write(0);Another cool technique is using a Digital-to-Analog Converter on the chip for debugging purposes
- Set up a DAC to output to any available pin
- Feed in the data you want to inspect in real time into the DAC
DAC input must be a 8bit unsigned number (like char or uint8)
- If data you want to read is something like a uint32 or int16
- Normalize the data point before feeding it into the DAC
// Example
int32 noise_level; // This is the value we want to read on our oscope
/* If we know that we do not expect values to be as large as 2^31
and we know that the largest value,
when divided by 16 is <= 255
we can downsample, cast to uint8 for the DAC, and feed it in
*/
DAC_SetValue( (uint8) ( noise_level/ 16 ) );
// Every time the above line is hit, it will be read on the oscilloscope- Connect that pin to your oscilloscope to read the outputs in real-time
Why not just use an LCD?
- There may be some data we want to measure in real-time, and perhaps an LCD will not be adequate at updating as fast as we require
Works best for slow changing variables, or displaying text messages
Usually pretty hard for a regular person to read an LCD display at a rate faster than 2x/sec
