Friday, November 28, 2014

Getting Started with Cheepest PSoC4 - CY8CKIT-049 42xx Prototyping Platform : PART ZERO

Hi Everyone,

Welcome to my Getting Started with Cheep (4$) Cypress PSoC 4 - CY8CKIT-049 prototyping platform Series. In this post I will talk about setting up the Environment for PSoC4- CY8CKIT-049 42xx prototyping platform, getting and setting up the platform itself. From next posts onwards I will talk about getting started with programming :) . Let's begin :P 


1. Introduction

1.1. What is the Cypress PSoC 4 ? 

The simplest answer is that PSoC is a programmable system on chip i.e. you can think of it as a mixture of microcontroller, FPGA and configurable analog :). That simply means that you now have the ability to configure the design to the hardware level (somewhat !) and as with other MCU's you can anyways continue with the software configuration.
To understand this more clearly, let's assume you have a project where you need to configure an analog temperature sensor at pin 12 of your device. and by mistake/due to old design's you made a board in which pin 2 of your MCU was connected to temperature sensor !! :( Now, the only way you can correct the mistake is wither my manually doing the rework on the board (which is messy) or by making a new board (Lots of money gone :( !!). With PSoC you simply just have to reroute the temperature sensor signal to the appropriate pin (i.e. pin 2) and voila you are done. No hazels what so ever. 

For more information on Cypress PSoC please visit:
http://www.cypress.com/psoc/?source=CY-ENG-HEADER

1.2. What is PSoC4 Prototyping board ?


Cypress PSoC4 CY8CKIT-049 42xx/41xx are Cypress's Lowest cost and moderately featured DevBoards. These Boards cost about 4$ and are well suited for learning Embedded Systems, using them in one of your designs or evaluation of PSoC4 42xx/41xx SoC . These kit's are based on Cypress's PSoC4 technology, i.e. Programmable System on Chip (4 signifies the family : in this case 4 means the base MCU is ARM Cortex M0) and has everything you need to get started.

For More information about the Kit's please visit :
http://www.cypress.com/?rID=92146

1.3. Why is it good for beginners, hobbyist, Makers and educators?

There are couple of reasons why I would prefer these kits for beginners, hobbyist, makers and educators.
1. Easy to understand and Learn : The PSoC Creator IDE has a drag and drop based interface, with easy graphical configuration of the Modules. For Example, if you want to control a GPIO , Just drag the Pin Module to the workspace and configure the module graphically.
2. Flexibility of use : As discussed previously, if you have loads of connections or wiring and you want to change one or two of them, no problem just do a Software Fix. PSoC Creator gives a pin map of the PSoC you are using, You can drag the function you have created and manually map it to the pin you want, which is really neat :P
3. Bread board Friendly : We can solder some headers and can prototype directly using breadboard.
4. Free USB to UART/I2C/SPI Tool : The Cypress (CY7C6521x) USB converter on the board can do USB to UART, USB to I2C and USB to SPI :) all of that can be configured using the USB configuration tool on PC. Connections are made using the GPIO header provided on the USB to UART section of the kit.
5. Can implement Digital Logic using the on board UDB : Cypress PSoC4 42xx series of SoC has four UDB's (Universal Digital blocks) which can be reconfigured to make some digital connections. like clock divider for Blink LED Application, etc.
6. Can also do a cut down version of verilog : Another awesome feature of PSoC is, as it has the UDB's you can make use of that and implement some small hardware Glue logic to the Software you write. For this feature you can create your own custom module and try and instead of C backend you can do Verilog coding making use of the UDB's.
7. Can create your own Module Blocks : It's almost obvious that you wont always find a module for each and every sensor. Worry not, you can create you'r own custom module and share it with the community to use it.
8. No need of learning the API's as API's are auto generated for each module : A very neat feature of PSoC Creator is the API's structure and Datasheets for each API's. So if you need to use ADC in your design, you dont have to go through a 1000 pages datasheet searching for ADc and the through another 1000 page API set documentations. You can click the datasheet component and will get all the relevant information of the component right there, including all the API calls and references. Further, the API's are auto generated like "beans" in Code warrior, so if you have your LED named with "RED" in your design, you's API's will be like RED_Write(1); 

Well I will leave the conclusion of the above question to you :P.


2. The Board 
The 4$ Dev Kit is based on Cypress CY8C4245AXI SoC, and have a User LED, Current Measurement header, Boot/User Switch, ~40 GPIO's, A usb to UART/I2C/SPI convertor with GPIO's all in a breadboard friendly Format.[Refer image above].

Ordering the Modules : You can order the Module directly from Cypress, Digikey or mouser :) 
Cypress :  http://www.cypress.com/?rID=92146
DigiKey : http://www.digikey.com/product-highlights/en/psoc-4-cy8ckit049-4xxx-prototyping-kits/52444
Mouser : http://www.mouser.in/new/Cypress-Semiconductor/cypress-cy8ckit-049-kits/

IMPORTANT NOTE : While ordering the Module Always order 2 or 3 modules. As these Modules work on UART Boot-loader and if you forgot to add a Boot-loader Module to the Design, you will need another kit to reprogram the previous Module.

2.1. Preparing the Board

For preparing the board you need couple of things, 
1. Soldering Station 
2. Flux and Soldering Lead
3. Long/ Short berg strip's 0.1" spacing (Standard headers)  22pins(2 nos.), 17pins(2 nos.), 7pins(4 nos.), 2pins(2nos.)                    
4. 90 Dig angled berg strip 0.1" spacing (Standard angled headers) 5pins(2nos.)
5. the Boards obviously ;) (2nos.)

STEP 1 : If you have a long berg strip, you have to break them into the above mentioned configuration (22pins, 17pins, 7pins, 5pins(angled) )
STEP 2 : If you have standard Headers solder them as shown in the picture below: 
I usually like to plug the board on to bread board and try to use both the Breadboard as well as the Pins for connecting me External components. So, If I want a pullup resistor, I use the breadboard but for an external module interface I try and use the pins directly :) ;) 
So, To do that Follow the Steps Below :) 

STEP 2.1 : Insert the berg connectors opposite ways into the board as shown in the pic below.




STEP 2.2 : Solder the Berg Connectors on the board and, Remove the separator from the berg connectors as in the pic below.

STEP 2.3 : Insert the separator towards the Bottom of the PCB, with the notch towards the PCB. (As shown in the Pic above - the black part).

STEP 3 : If you want to use the USB to UART separately, then break the USB to UART section of the board from the body and solder 4pin berg connector 0.1" (standard/angled headers) on ether sides of the boards and you are done. Reference Images below, 




STEP 4 : If you want current measurement on your device : the You have to remove the 0 Ohm resistor marked in white below, and solder a 2 pin berg connector marked by Blue. To power the board always short the 2 pin connector with a standard Jumper. To measure the current drawn, disconnect the jumper and contact the positive and negative wires of multimeter to the 2 pin connector.
-

Now we have prepared our board's for the Journey it's will go through :P :P :P

3. Installing the Software

We will go through the steps of installing the new software for the Kit. This kit is only supported on windows.

STEP 1 : Downloading the Files
Download all the necessary files from cypress servers :
                                       CY8CKIT-049-41xx CD ISO (Creator CD) (For 41xx boards)
                                       CY8CKIT-049-41xx Kit Only (Kit Design Files, Documentation, Examples)
USB SDK and config :  USB-Serial SDK Windows Installer & Configuration Utility

and also download the Quick start Guides and Reference Design Files if you wish.
All in one Link : http://www.cypress.com/?rID=92146 

STEP 2 : Installing the Software
Mount the iso image and install the Software, PSoC Creator, PSoC Programmer, Bootloader Tool and etc. This process may take up to 30 min, so grab a coffee :) :P. Then install the USB SDK. Then finally extract the contents of the Essential files list to c:\psoc4\cy8ckit049_42xx\, you can choose any directory you like.

and yup we are done :)

Step 3 : Unboxing of the KIT
This kit comes in a unique awesome eco friendly package with all the pin out's at the back, To unbox simply tear down the front. <Unboxing Video Coming Soon>

[Images are taken from Internet, Will upload my own Soon]

Step 4 : Testing that everything Works :) 
The most easy step :) Connect the board to a computer's USB port/ Power bank and check the LED's Going off.



Some more tests,
TEST 1 : Open the "Cypress USB configuration utility" , Connect the Board (go-through the windows driver installer first time) , Click "Select target" option and click "connect". If you get the device details, i.e. you are able to see a new tab next to the Select Target tab that means the device is working fine.

TEST 2 : Dumping the Example code : Open PSoC Creator Software then you have to open the Bootloader Host Tool,
PSoC Creator -> File Menu ->Tool -> Bootloader Host
once done that browse c:\psoc4\cy8ckit049_42xx\CY8CKIT-049-42xx PSoC4 Proto kit\SCB_Bootloader_42xx\Bootloadable Blinking LED.cydsn\CortexM0\ARM_GCC_473\Debug\Bootloadable Blinking LED.cyacd file in the "FILE" dialog, Select the appropriate Kit in the "PORTS" view , make sure that the baud is set to 115200 and then hit the "Program" button (next to the File button). You will see the status bar going and within seconds you can see the LED on your board blinking. This means that all set to Go. :D

FUN StuFF

Fade Example using the on board LED on the Board :P 


Gurinder Singh Gill
technervers.com




P.S. :-> All my code is OpenSource and is hosted on GitHub : https://github.com/gsgill112/PSoC4_CY8CKIT-049_Tutorial Please visit the above link for source code :)

Saturday, November 22, 2014

Make Your own FREE Bluetooth Serial Module : PART 2

Hi,
This is continuation to my previous blog. In this post I will go through the steps of building the module itself and share some of my findings :)

NOTE : Unfortunately due to lack of a good camera with stand I haven't recorded the construction Process :(.

So, lets Go :) 
In my last post I had mentioned how to procure the IC and basic components you may need for constructing the module. I had also posted some reference images to follow. Hopefully by now you guys may have received the module  :) :)

Step 1  :   Preparation

 For the first step just grab everything required for the construction as listed in my last post  Here are some of the pics for the module I got from TI :) (Please mind my camera Nexus 4 isn't known for it's cam quality :P)

 




Step 2  : Getting  Power Signals soldered 

Firstly, apply flux to the entire pad array as shown in the picture below 


Then Solder the GND pins together. Further in the pictures below I have soldered the CTS pin to GND also, but I will recommend you guys to do it later once we are finished soldering the OP3 pin :)

Also connect the 32Khz + pin to GND as suggested by TI . 


Finally, solder the VCC signal, that is VCC+ V_Core as shown in the reference images in my previous post. Now we have the power supply up :) , At this point grab a multimeter and check for shorts between VCC and GND :)
 

Step 3  :  Soldering other Important signals

In order for us to work with the module, we must first get the UART Signals set up :), as well as the Baud Rate select pins selected. You can change the communication Baud rate by tweaking the pins OP3, OP4 and OP5 in the below fashion,(I have used 9600 Baud by default)

OP3 OP4 OP5 Function
1 0 1 UART speed 9.6 kbps
1 1 0 UART speed 115.2 kbps
1 1 1 UART speed 921.6 kbps


We will start by soldering 1K pull-up resistors to the respective OP3 and OP5 pins and will later connect them to the VCC pins.

Meanwhile also connect some long wires to the Rx and the Tx pins of the module.


 And some neat trick for connecting the resistors to VCC.


After successfully connecting the resistors, now is a good time to connect the CTS pin to ground :) 
Now our module is almost ready :) , to test : power on the module and check weather you get a "Serial Port Device" of some MAC Address in your Bluetooth scan list. If everything is fine, glue up the connections or simply add a double sided tape to firmly attach the wires hanging out :).


Step 4  :  Making the module 

We now will build the base of the module and make this a plug and play module :) .

First, we will choose the corner of a prototyping PCB. and align the module in such a way that the upper part of the module till the horizontal pins do not come in contact or is near to the prototyping PCB copper pads.(The upper section of the Module is the Antenna and we should have some antenna clearance or else the signal from the module may be week.) as shown in the bottom images.


Then we cut  the amount prototyping PCB required for us. Always cut a bit more than required for margins :)


then we insert the VCC, GND Rx and Tx, wires through the holes and solder them to the PCB. Meanwhile, also solder 4pin 90dig 0.1" standard headers and connect the header to the signals.


So, Our module is ready :) :D , I always forget what I do after couple of days :P  so it's always a good idea to label each pin with a permanent marker :). Finally I also like to hot glue things up as sometimes if the double sided tape gets off the it's a problem :( .


NOTE : Handel the module very carefully through Step 4. As the wires as well as the pads are delicate. It so happened for me that while going through Step 4, I somehow broke the OP3 Pad from the module and the entire module was done :( .

Step 5  : Testing the module 

Well the easiest way to test is connecting it with an MSP430 Launchpad/Arduino/etc. and just do a serialPrint(Receving). You can use my Bluebot Project code for the MSP430 Launchpad here which already has that done. Visit my LMX9838 Module interfacing with MSP430 Launchpad post for further interfacing here

Some Important Tips for Soldering and construction  
 
Tip 1 : Always apply flux to the pad and tin the pad before soldering a wire to it. 

Tip 2 : Always try and Short all the ground and power pins as few of them are sometimes regulator references and they are important to be connected to VCC. (Well check the datasheet for specific instructions)

Tip 3 : Always heat the pad a bit first before inserting the tin thread for better soldering (The Tin thread usually has flux on top of it which makes it easier that ways for sticking)

Tip 4 : Do Not HEAT the pad for larger duration as due to over heating, the pad may wear off/ or worst rip of :( - That happened to me so take care .

Tip 5 : Always tend to use single stand thin wires with coating or extracted copper wires with coating :) this saves loads of time and energy :)

Happy Hacking
Gurinder Singh Gill
technervers.com

Sunday, November 9, 2014

Make Your own FREE Bluetooth Serial Module : PART 1

Hi Guys, as promised, this is an Instructional blog on how to make your own FREE Bluetooth 2.0 Module for your projects.



First of all You need one of the Modules :  
Step 1 : Make a free Account on Ti.com (Use any Email ID, GMail works fine)
Step 2 : Make sure you are logged in and browse to www.ti.com/product/LMX9838/samplebuy
Step 3 : Click on the "Free Sample" icon and click "continue with free sample" icon.
Step 4 : Fill in the details and Click "Check out" link.
Step 5 : Follow the On-Screen instructions and you are done.

NOTE: Sometimes you will be asked about why you want to sample the IC, you have to explain about your project in brief.
NOTE : TI only allows approx 30$ of Free IC's per transition, and A maximum of ONE transition pre month. So If you are ordering the same IC twice in one month the former Order may be canceled, in which case you have to re order the sample next month.

So the shipping will take approx 3-4 Days after order conformation, mean while, if you already dont have the required components, you will need the following :

Now that we have everything with us, LETS BUILD :)
You may need some references so please download the below Reference pictures(I will also upload it as a zip)
REFF 1
REFF 1
Baud Pins
UART Pins
Uart Connection
Baudrate connection


I will post the construction steps in PART-2 of this tutorial. 

Thanks and Regards,
Gurinder Singh Gill
Please visit me at : technervers.com

Wednesday, November 5, 2014

PSoC 4 here I go :)

Hi Guys,

Last week I visited awesome campus of "Cypress Semiconductors India Private Limited". Beside some really amazing technologies they are working on, one of the most prominent, is the Cypress PSoC family.

They gave me few of their, Hobbyist friendly, Cheep PSoC based kits to try out. The list contained

CY8CKIT-042 PSoC 4 Pioneer Kit

CY8CKIT-040 PSoC 4000 Pioneer Development Kit With the Coloue selector Shield

PSoC 4 CY8CKIT-049 42xx Prototyping Kits

I will be doing short learning/project based tutorials on them and will explore/learn these kits while doing so :). 

These kits are like really awesome. How ? Well here are the highlights : 

1. The PSoC is a reconfigurable MCU. 
What that means is that suppose you are interfacing an Accelerometer sensor to the MCU, On arduino/etc boards, if you got one of the connections wrong ? Well you have to redo all the H/W connections, but with PSoC it's just a Software change :D :D and yes you are done no H/W rewiring required. This holds true for some breadboard interfacing where you have loads of connections and well you dont want to redo all of then :P ;). 

2. Really Low Cost !! 
 You can get one of the fully Programmable PSoC Prototyping kits for like 4$ ~= 250Rs Well that's practically FREE + You get a bonus USB to UART/I2C/SPI converter for FREE :D :D :D that's just Superb !! 

3. PSoC creator 
Believe me or not, PSoC creator is most fun to use IDE I have worked on so far. Common, which other IDE generates API's for you to use ? :P 

4. Programmable Programmer !! :D :D
Well we all know that Except Arduino and some other DEV Boards, all other Dev Boards has on board MCU that act as programmer/debugger. some have FTDI for that. But, have you ever heard of Programmable Programmer ?? in CY8CKIT-042(25$) and CY8CKIT-040(30$) the programming and debugging is done using PSoC5LP MCU, and trust me that is fully programmable !! So, if you want to do some LED ON/OFF for power enable or some thing else?? you can use the on board PSoC5LP header/GPIO's instead of using one of the Target MCU's .. This is Mind-blowing

5. Arduino R3 compatible header with Selectable 3.3v/5v Voltage levels . 

And the fun Goes on and On ... ... ...

In the coming few posts I will take on each of these kits and go into a bit more detail, but I will be finally focusing on The Cheapest available and Breadboard friendly  the PSoC4 CY8C-049-042xx Kit. and we will make some cool projects using that kit. 

Lastly, A teaser Pic :P :P ;)

You Guys can jump in and share any projects, which we will build using these platforms :) :D 

Thanks & Regards
please visit me at  technervers.com