CY8CKit-059, fw-loader, KitProg, KitProg2, KitProg3, Ugh.

I have commented on my path to getting to the point where the PSOC5LP can be used with the Macintosh (or Linux or Windows) without PSoC Creator except for the initial internal schematic based hardware design.

As I have commented in the past, the WYSIWYG Graphic Design Tool for the UDB’s in the PSCOC5 is excellent. Unfortunately, Infineon in their great wisdom *cough* has decided UDB’s are not what they want to do in the future.

Fortunately, their current statements are the PSOC5LP will be supported for a few more years. But, like all political statements, we have to wait and see. Fortunately, it is now cheap to make, and has found its way into many of their development tools.

It took a *lot* of work to exceed 24 UDB’s available in the PSOC5. It took only 2 devices in a PSOC4 (4245) to exceed the 4 UDB’s available, and the PSOC4 routing capabilities are just barely usable. With the PSOC 4, you have to develop your internal schematic and then fight the pin layout monster, and *then* you can go to a PCB layout.

With the PSOC 5, you just follow a few guidelines, and route PCB pins where you want them, with only a few exceptions: USB, Power, and some analog I/O, if you want maximum power capabilities or filtering for your A/D. You can have the board fabricated in parallel with schematic and firmware design and development. A real boon for time to market.

KitProg, KitProg2, KitProg3 and 059 kit

The KitProg that comes on the CY8CKit-059 is not a KitProg3. It is not a KitProg2. It is a KitProg. However, it is the same schematic with the same parts. With at least one important exception.

I purchased a 149 kit so I could try to duplicate the programming and testing of the PSOC4 family on the Mac using VSCode because it has a PSOC 4 on it. So far, no luck. I can connect, but I can’t control the PSOC 4. Oh, well, the PSOC 4 is probably not going to be used on future items, unless it passes heat test (350F).

I remembered a note from Mr. NooteBoom about upgrading the KitProg to KitProg2. (The link to his note in the Cypress Community is: https://community.infineon.com/t5/PSoC-Creator-Designer/Convert-Kitprog1-into-Kitprog2/td-p/172120)

During my search I found the KitProg2 can be upgraded to a KitProg3. I also found out about the updated firmware loader from C/I (Cypress/Infineon). The link to that is: https://github.com/Infineon/Firmware-loader.

The Journey to KitProg3

I downloaded the fw-loader. No real instructions. After some googling, I understood I had to use the terminal program on the Mac / linux (or command prompt on Windows) and I had to be in the folder where I could see both the fw-loader directory and the kp-firmware directory. In order to run the firmware loader, I had to then execute the command “fw-loader/bin/fw-loader –help”

w:fw-loader-3.3.0.1370-macos mxf$ fw-loader/bin/fw-loader --help
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Supported command line parameters:

	--help				Displays this info

	--device-list			Displays list of connected devices

	--update-kp3  [device-name|all]	Updates FW of the device with specified name to KitProg3
					Device name is taken from the '--device-list' command

	--update-kp2  [device-name|all]	Updates FW of the device with specified name to KitProg2
					Device name is taken from the '--device-list' command
					Downgrade to KitProg2 is allowed only for devices: CY8CKIT-062-BLE, CY8CKIT-062-WiFi-BT,
					CY8CPROTO-063-BLE, CY8CKIT-041-40XX, CY8CKIT-041-41XX, CY8CKIT-048,
					CY8CKIT-145-40XX, CY8CKIT-146, CY8CKIT-147, CY8CKIT-149, CY8CKIT-148

	--mode <mode> [device-name]	Switches mode of the KitProg3 device with specified name
					Supported modes are: 'kp3-hid', 'kp3-bulk', 'kp3-bootloader', 'kp3-daplink', 'kp3-dualuart'
					On Windows hosts 'kp3-bulk' mode cannot support simultaneous I2C/SPI bridging
					(e.g. for CapSense tuning) - switch to 'kp3-hid' instead

	--info [device-name]		Displays the device information. Device information is displayed only for
					KitProg devices which support KitProg3 Unique ID Record

	Note:
					The device-name argument can be skipped if only one KitProg device
					is connected to the host.
					To update FW of all the connected KitProg devices use 'all' specifier

Ok, so do a –device-list. So I did. Nothing. Ugh. (Side Note: I will not show the w:fw-loader-3.3.0.1370-macos mxf$ terminal prompt string from this point on. Just the commands typed.)

fw-loader/bin/fw-loader --device-list
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start API initialization
Info: Hardware initialization complete 258 ms
No connected devices

Next step, take the 149 kit so I can see if it sees the KitProg2 and can upgrade it. Yep. It did. I have subsequently upgraded it to a kitprog3, so it shows as the following:

fw-loader/bin/fw-loader --device-list
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1B11050D00250400
Info: Hardware initialization complete 467 ms
Connected supported devices:
	1: KitProg3 CMSIS-DAP BULK-1B11050D00250400	FW Version 2.30.1155

I did that by using the following command. (I am doing this on the already upgraded KitProg2 with the 149 kit.)

$fw-loader/bin/fw-loader --update-kp3 all
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1B11050D00250400
Info: Hardware initialization complete 469 ms
Found KP firmware image: "/Users/maxfield/Downloads/fw-loader-3.3.0.1370-macos/kp-firmware/kitprog3.cyacd"

Updating FW on 'KitProg3 CMSIS-DAP BULK-1B11050D00250400'
Info: Kit FW is 'KitProg3' ver. 2.30 b1155.  Upgrade file is 'KitProg3' ver. 2.30 b1155.
Info: Disconnected - KitProg3 CMSIS-DAP BULK-1B11050D00250400
Info: Connected - KitProg3 Bootloader-1B11050D00250400
Info: Bootloader Version: Major 1, Minor 1, Build 40
Info: FW Upgrade to version: 2.30 b1155
Info: Bootloading of KitProg FW...
Info: Verifying of KitProg FW...
Info: Bootloading of DAPLink...
Info: Verifying of DAPLink...
Info: Upgrade completed 
Info: Disconnected - KitProg3 Bootloader-1B11050D00250400
Info: Connected - KitProg3 CMSIS-DAP BULK-1B11050D00250400
FW update on KitProg3 CMSIS-DAP BULK-1B11050D00250400 completed successfully

FW update operation has been completed successfully.
Updated device list:
Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1B11050D00250400
Info: Hardware initialization complete 466 ms
Connected supported devices:
	1: KitProg3 CMSIS-DAP BULK-1B11050D00250400	FW Version 2.30.1155

Fortunately, C/I engineers realized that sometimes an upgrade goes wrong and has to be done again, so even though the devices is programmed with the latest version, it will program again.

So How to Update The 059 Stub?

Well, that involves soldering some wires. I had an older KitProg stub hanging around that I had already flowed solder on the fingers because the extender cable I was using had its contact wipers compressed and the connection was iffy. So, I followed Mr. NooteBoom’s wiring diagram, hooked up a MiniProg3 on my Windows VM. It failed.

Hmm. After watching several failed programs, I realized that using a MinigProg3 would probably never work on a VM. The turn around time for programming the PSOC when going over the USB is too tight of a window for the VMWare device driver layering to work. So I hooked up a KitProg and programmed it. Success!

I did this with the PSOC Programmer version 3.29. The file that I used to program it with is in C:\Program Files\Cypress\Programmer directory and is named KitProg3.hex. The programmer does not care where the file comes from.

That took the KitProg to KitProg3 version 2.10. I wanted version 2.30, as it can be connected to and used as a serial terminal at the same time debugging is occurring, on Linux or Mac OSX (not Windows). I shut down the VM (!!IMPORTANT!!) plugged it in, and did a device list command from my Mac terminal. (If you leave the VM up, VMWare grabs the USB and puts it into windows during stages of the programming of the device.)

fw-loader/bin/fw-loader --device-list
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1E0E14C900020400
Info: Hardware initialization complete 468 ms
Connected supported devices:
	1: KitProg3 CMSIS-DAP BULK-1E0E14C900020400	FW Version 2.10.878 [outdated]
Warning: Firmware on KitProg3 CMSIS-DAP BULK-1E0E14C900020400 device(s) is outdated. Use --update-kp3 [device-name|all] to update.

I then did a list of the tty devices on my Mac, and there it is. It is listed as /dev/tty.usbmodem144403. In my experience, the KitProg devices present themselves as a usbmodemxxxxxx (where xxxx is always a number).

ls /dev/tty.*
/dev/tty.Bluetooth-Incoming-Port	/dev/tty.URT1				/dev/tty.usbmodemRF8NA20FP1T2
/dev/tty.S05A-GAIA			/dev/tty.usbmodem144403

Next step is to do the update. Since this is the only KitProg plugged in, I use “all” for the upgrade command:

fw-loader/bin/fw-loader --update-kp3 all
Cypress Firmware Updater, Version: 3.3.0.1370
(C) Copyright 2018-2021 by Cypress Semiconductor Corporation (an Infineon company)
All Rights Reserved

Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1E0E14C900020400
Info: Hardware initialization complete 461 ms
Found KP firmware image: "/Users/maxfield/Downloads/fw-loader-3.3.0.1370-macos/kp-firmware/kitprog3.cyacd"

Updating FW on 'KitProg3 CMSIS-DAP BULK-1E0E14C900020400'
Info: Kit FW is 'KitProg3' ver. 2.10 b878.  Upgrade file is 'KitProg3' ver. 2.30 b1155.
Info: Disconnected - KitProg3 CMSIS-DAP BULK-1E0E14C900020400
Info: Connected - KitProg3 Bootloader-C90002140E1E0204
Info: Bootloader Version: Major 1, Minor 1, Build 60
Info: FW Upgrade to version: 2.30 b1155
Info: Bootloading of KitProg FW...
Info: Verifying of KitProg FW...
Info: Bootloading of DAPLink...
Info: Verifying of DAPLink...
Info: Upgrade completed 
Info: Disconnected - KitProg3 Bootloader-C90002140E1E0204
Info: Connected - KitProg3 CMSIS-DAP BULK-1E0E14C900020400
FW update on KitProg3 CMSIS-DAP BULK-1E0E14C900020400 completed successfully

FW update operation has been completed successfully.
Updated device list:
Info: Start API initialization
Info: Connected - KitProg3 CMSIS-DAP BULK-1E0E14C900020400
Info: Hardware initialization complete 460 ms
Connected supported devices:
	1: KitProg3 CMSIS-DAP BULK-1E0E14C900020400	FW Version 2.30.1155

Since the KitProg3 shows it is left in CMSIS-DAP mode, all I have to do is use it with VSCode.

Nope. Does not work. No combination of configuration files and modes makes it work with VSCode and the OneThinx toolkit. The PSOC5LP.cfg file fails to take control of the PSOC5LP device. This is with version 2.30. So I program in version 2.10. No go. Ugh.

The problem may be the *one* small difference between KitProg and KitProg2/KitProg3. That difference is SW3, which is connected to P1[2] (pin 13 on the QFN package). (On the KitProg, it is connected to the reset line. There is also a SW4 on the KitProg2/3 kits.)

Getting Back to KitProg

Fortunately, the KitProg hex file is in the same location as the KitProg2 and KitProg3 file. So, this time, I created a “programming kit” for the finger stub KitProg debugger using a chopped off section of a beaten-up USB extender cable. The wires are kept separated with clear plastic tape. The “schematic” for it and the final results are here. (This borrows heavily from Mr. NooteBoom’s post in the Cypress community, mentioned above.)

Here is it plugged into the board, with a 30 gauge red (wire wrap) wire soldered to the correct location for using !XRES:

I plugged in a KitProg stub into the 5 pin socket on the left and programmed the KitProg back into the device.

Back To the Past: KitProg2 upgraded to KitProg3

Well, that was sad. Not Sure what I can do about it.

OK. I have this shiny new KitProg2 that I got, upgraded to KitProg3. It is in CMSIS-DAP mode. Will it Debug?

YES!

It works using the configuration I described in the preceding posts on how to bring the CY8CKit-059 to the point you can develop, build, and program the PSOC5LP on the Macintosh.

I made sure the KitProg3 was in CMSIS-DAP mode, (amber light on solid) and connected it to my device. It programmed up, ran to main, and single stepped. I was able to use it.

Hmm. I did not really try KitProg2 in my KitProg. So….

I went back and programmed the KitProg into KitProg2 mode, CMSIS-DAP as shown by amber light, and same result as with the KitProg3 inside the KitProg. NO GO.

Moral of the Story

So, the moral of the story is KitProg can be programmed with KitProg2 or KitProg3, but can’t debug the PSOC5LP. You can only debug the PSOC5LP with a KitProg in CMSIS-DAP mode or with a KitProg3 in CMSIS-DAP mode. You *cannot* upgrade the KitProg at the current time, with the default firmware without a programming harness.

But all may not be lost….

Future Possibilities

The interesting thing about the KitProg3 is the PSoC Creator project for it is here: https://github.com/Infineon/KitProg3. Its source can be modified to fix this, if there are any of you out there with time.

I suppose that when I get my next round-tuit, I can at least change the KitProg3 code to default to the CMSIS-DAP mode at power up, and see if VSCode can use it with the OneThinx toolkit. There may be something else at play here, maybe too slow of a device being used on KitProg?

However, I am out of time for now!

Enjoy!

Add a Comment

Your email address will not be published. Required fields are marked *