In this article I will talk a little about the Cypress PSOC4 family of devices. Then I will explain the method I use to debug a cheap CY8CKIT-049-42XX board using a not so cheap CY8CKIT-042 Pioneer kit.
Cypress PSOC 4
Cypress PSOoC 4 is an interesting blend of MCU and programmable logic. It includes an ARM Cortex M0 CPU together with some programmable logic all in one chip. That way you can develop a system not only a MCU brain but also some custom digital peripherals. The Cypress web site has more information about it so I will not explain any further.
One interesting point about those devices is that the developement software PSoC Creator is freely available from Cypress alhough it is a Windows only application.
PSOC Creator 3 |
The application enables to develop both the programmable logic and the MCU programs. The glue code to link the program to the digital devices is created on the fly. It should be easy to develop an application in no time alhough I have not dedicated much time to explore the IDE features.
CY8CKIT-049-42XX Board
Texas Instruments broke the low level MCU development hardware with it's Launchpad when they sold it an only 5€ (now it is about 10€). Now Cypress is following the same path with its CY8CKIT-049-42XX board. This board sells for about 4€ and for it's price it's good deal. I bought mine at Farnell.
CY8CKIT-049-42XX |
Cypress also sells another board, the CY8CKIT-049-41xx at the same price. But as it is a less featured board at the same price so I don't recommend it.
The board is a two part construction that can be directly connected to a free USB port. The left part of the board, that includes the USB connector, include a CY7C65211-24LTXI devide that implements an USB to serial bridge. The right part of the board includes the main chip of the board, a PSoC4 CY8C4245AXI-483 in a TQFP 44 pin package. A little pushbutton and a blue LED act as a minimalist peripheral set and complete this side of the board.
The CY8C4245AXI-483 main chip features a 48MHz ARM Cortex M0 MCU with 32kB flash and 4kB SRAM memories. It also includes a 12 bit SAR ADC, a pair of operational amplifiers, a pair of comparators, 4 timers, 2 serial peripherals and the hardware to interface to cap sense inputs. Next to the MCU it includes digital programmable logic in the form of 4 Universal Digital Blocks. Each of them includes 8 macrocells, one 8 bit datapath and two 12 input PLDs. Quite a lot to play with at only 4€.
The CY8C4245AXI-483 main chip features a 48MHz ARM Cortex M0 MCU with 32kB flash and 4kB SRAM memories. It also includes a 12 bit SAR ADC, a pair of operational amplifiers, a pair of comparators, 4 timers, 2 serial peripherals and the hardware to interface to cap sense inputs. Next to the MCU it includes digital programmable logic in the form of 4 Universal Digital Blocks. Each of them includes 8 macrocells, one 8 bit datapath and two 12 input PLDs. Quite a lot to play with at only 4€.
You can use the PSoC Creator software to program the main chip in the board, but as it doesn't feature any JTAG or equivalent connection you are limited to programming using a bootloader that is preprogrammed in the chip. That means that you also need to include the bootloader in any user program as it is needed to do any future reprograming of the board. The bootloader, of course, takes a little space on the program memory. This not a big deal, Arduino has been using bootloaders for ages but it is sure a worse solution that the TI Launchpad that include both a two wire Debug link AND a Serial bridge.
I ordered two CY8CKIT-049-42xx boards. The first thing I do when I receive a development board is to try to program it to check the software. I downloaded the PSoC Creator software and I tried to program a boatloadable PSoC 4 example that is provided for this board.
To program the boad, you need to enter in bootloader mode. To do that you need to press the user button at the same time you insert the board in an available USB socket. One of my boards worked fine and I could program it with no problem. The other, however, wasn't able to enter in bootloader mode so it could not be programmed. I suspected that the problem was the push button so I re soldered its connections. After that, it worked ok. Perhaps there are some quality issues in the manufacture of those boards.
The board is designed to be cut at the serial link between the two chips, just after the serial bridge. It also includes some pins to do proper debugging of the main MCU. To do that, you are suggested to buy a MiniProg3 kit. At 74€ at Farnell it's not a bad option to debug the board.
Board connections |
Soldered Connectors |
So far so good, I have a cheap development board to play with, but I don't like bootloaders to do developing so my goal is to use the debug port to program the board.
CY8CKIT-042 Pioneer kit
The CY8CKIT-42 is a more featured board that previously described CY8CKIT-049-42XX one. Both feature the very same main chip, a CY8C4245AXI-483, but the rest of the board is quite different. The price is also different as this board cost about 20€.CY8CKIT-042 Board |
I tested to program this board and do some step by step debugging without any problem. As the cheaper CY8CKIT-049-42XX features the same main chip, I thought about programming it using the debugger in the pioneer kit. Unfortunatelly this is not as easy as in other boards.
Both in the Texas Instruments Launchpad boards and in the ST Discovery boards the flash emulator and the main MCU are connected through jumpers so that you can separate the emulator from the main chip enabling you to use the emulator to develop another board. This is not the case in the pioneer board.
In this board, the PSoC 5 emulator chip is connected to the emulator lines using several zero ohm resistors. Zero ohm resistors R11, R16 and R15 connect the RESET, SWDIO and SWDCLK lines.
PSoC 5 Emulator Zero Ohm link resistors |
Debug Connector |
The solution proposed by Cypress to do debugging in another board using the pioneer PSoC 5 emulator is to desolder the R34, R32 and R33 resistors and use the J6 connector to stablish the debug link.
Pioneer board debug elements |
- Removing R34, R32 and R33 disables the programming of the PSoC 4 chip included in the board.
- I have no connector that match the 50 mill fine pitch debug connector J6.
Changes in the board
I carried a modification to enable the board to be used as an external debug programmer fro the CY8CKIT-049-42XX board without losing the optin to program the pioneer board PSoC 4 chip.The idea is to remove all six resistors R11, R16, R15, R34, R32 and R33 and substitute them with a 100 mill standard male connector.
First thing is to locate those resistors, they are between the small PSoC 5 chip and the larger PSoC 4 chip.
Resistors to remove |
Resistors removed |
Standard 100 mil male pin strip |
In the first pair I connect the left side of R11 with the left pin and the right side of R34 with the right pin. For the two other pairs I do the same with R16-R32 and R15-R33. There is no problem if the pads of one resistor are shorted as long as only one resistor is shorted in each pair.
Connector soldered in the board |
Side view |
If all goes ok, the connector separates the three debug signals SWDIO, SWDCLK and RESET from the emulator to the PSoC 4 main chip. To reenable the connections a jumper can be fitted in each pin pair as is shown on the next figure.
Connector with jumpers |
That way I can check that the board can be programmed ok as before.
The pin that was not used in the connector forms half a pair of pins and is designed to provide alignement to the connector so that it cannot be fitted in the wrong orientation. I soldered one wire from this pin to a GND node in the board to provide the needed common reference in the debug link.
Ground connection |
Debugging the CY8CKIT-049-42XX board
To debug a CY8CKIT-049-42XX we only need to remove the jumpers route the three debug signals and the common ground between the two boards. That means using the left four pins of the male connector.If we want to power the debugged board at the same time, we can use the Vdd connection at J5 in the pioneer board. After thinking about it I could have fitted a bigger two row male connector and include the Vdd signal.
Connected boards |
You know that the connection is ok if you can enable the debugger in PSoC Creator and detect the chip in the CY8CKIT-049-42XX board.
Chip detected in the debug link |
After that I modified a Cypress example program to test the debug functionality and it worked like a charm. Now I can properly debug the dirt cheap CY8CKIT-049-42XX board.