From hardware side, see this link.
Your external microprocessor will source similar signals as Kitprog for SWD interface.
Sorry, I can not help with software modifications. I use Kitprog for programming PSoC 4013 with above weblink details.
If your microprocessor emulates the same signals as Kitprog (which it should), then you should not need any modifications to A_Hssp_Programmer.cydsn software.
The main concern is to be careful with port P1.6 when using the PSoc 4000 series. This is mentioned in weblink.
Good luck with your project.
My concern is to program CY8C4014SXI-421 without opening the
PSoC programmer software from PC. Because of mass production,
I want to program the 4014 device from external circuit. So this
application note (AN84858) describes that your own controller will
act as a PSoC 4 programmer.
You don't have to open the PC and PSoC pgroammer. So what
I want to do is, I will program the "A_Hssp_Programmer.cydsn" project
in my controller. I will use the device CY8C5888LTI-LP097 from CY8CKIT-059
PSoC 5LP Prototyping Kit. So this controller is going to program
4014 device. If I am successfull in this project I don't have to open
the PSoC programmer every time to program the device in mass
You have a very good project for making production easier.
For a schematic, refer to the webpage above and the references at the bottom of webpage. In particular, this document:
CY8C4xxx, CYBLxxxx Programming Specifications, Document No. 002-22325 Rev. *C
You can use just about any 3 GPIO pins from KIT-059 to use as the SWD interface. Simply substitute KIT-059 CY8C5888LTI-LP097 GPIO's in place of the Kitprog shown on above webpage.
I use an older version of Creator, so I can't open "A_Hssp_Programmer.cydsn".
I followed your link (Solution: Use Kitprog to Program PSoC 4000 without XRES pin).
But I was not succeeded. So what could be the problem?
Even I tried programming CY8C4247 Microcontroller by following Application Note
(AN84858). I succeeded. But my code not working. I built a simple code of LED
blinking. Please help me in this application note.
I suspect you programmed CY8C4247 successfully using the CY8C4247 XRES pin. You don't mention this, so my guess.
Can you try programming CY8C4247 using Power Cycle method? Don't connect anything other than a pull-up resistor to CY8C4247 XRES pin. If it can not be programmed using Power Cycle method, then there is something wrong with the code or GPIO config in PSoC5LP that is used for programming the target CY8C4247.
Since CY8C4247 can be programmed, SWD clock and data GPIO's are working properly on 5LP. 5LP GPIO controlling XRES sounds like it's working since CY8C4247 can be programmed using its XRES pin. This would indicate something in s/w is not quite right.
It's mentioned in app note to change timing of GPIO controlling XRES pin to allow enough time for target to be powered off and then enough time for power up, before attempting to program it. If there is too much capacitance on Vdd, it will take longer than 100us to discharge to 0volts. So, this 100us could be increased to 1ms (or longer if needed).
When it works for 4247, it will work for 4014.
I have checked all the matter again. The controller I mentioned (CY8C4247)
was wrong actually. My controller was CY8C4245AXI-483. Now everything is
working perfect. I mean I successfully uploaded the HEX file using AN84858
in my controller and the code (LED Blinking) was working properly.
Now coming back to my original post about programming of CY8C4014,
I again followed the schematic suggested by you. It is working now. I was
also able to upload HEX file in CY8C4014SXI-421 controller. I modified
the code of AN84858 little bit and succeeded. I am also attaching the Image
(KitProg.jpg) to be followed when programming PSoC 4 devices which doesn't
have XRES pin. But the problem still persist when we try to program CY8C4014
device using KitProg. I am also attaching the Image (PSoC Programmer). It shows
that the power cycle mode programming is not available. So please suggest
what steps should I follow.
So, the final conclusion is, It is possible to program PSoC 4 device using
Application Note (AN84858). It is also possible to program PSoC 4 device
which doesn't have XRES pin. For the device which doesn't have XRES pin,
you have to follow attached image (KitProg.jpg) and make following changes in
Project Name : A_Hssp_Programmer.cydsn
1. In main.c file add delay of 1 second after pressing the switch SW2. (CyDelay(1000))
2. In Timeout.h file change DEVICE_ACQUIRE_TIMEOUT 60 to DEVICE_ACQUIRE_TIMEOUT 300
3. In ProgrammingSteps.c file and in DeviceAcquire() function change DelayHundredUs() to CyDelay(1000)
(Beween SetXresLow() and SetXresHigh() line)
Thanks for Help.
Congratulations getting AN84858 working with 5LP as a programmer.
I looked at Kitprog.jpg in your post and the pin numbering is not correct for Kitprog and 74HC14 device. Can you update drawing. Maybe this is why you were not successful with Kitprog programming the 4014.
PSoC Programmer does not show Kitprog supporting Power Cycle mode. However, that does not matter since the extra logic circuit provides the power cycle method. Simply program the target PSoC with Kitprog as if it has a XRES pin.
BTW, Kitprog with 74HC14 also works with Creator. You go into Debug menu, then program from there.
I have checked by programming CY8C4014 device by using
KitProg with extra logic circuit (As per your suggestion). It is working
in PSoC Programmer as well as PSoC Creator. I was not getting
successful in this method because I didn't know proper method. I
thought that when a person wants to program the PSoC 4 device
using KitProg and PSoC Programmer software, the Power Cycle
Option should me made enabled. My connection is correct as per
KitProg.jpg attached image (Only Header numbering and IC Pinout
numbering is different. But I have already written connection name
in Text.) User will have to follow this connection name while connecting
KitProg with extra logic circuitry and then to CY8C4014 device.
So, Again, Final conclusion is,
If user wants to program the PSoC 4 devices (for example CY8C4014SXI-421)
which doesn't have XRES pin, user will have to connect extra circuitry
between KitProg and PSoC 4 device. Extra circuitry is KitProg.jpg attached
in my previous reply. User will be able to program device from PSoC
Programmer software and PSoC Creator Software.
Thanks for updating my schematic. There is an issue again.
I am not able to upload HEX file in other CY8C4014SXI-421.
What could be the reason?
After reading your post (Jan 6, 2020 6:22 AM) I tried that method
on my PCB and I succeeded. And I posted the reply (Jan 7, 2020 10:59 PM)
But now I am not able to program other CY8C4014SXI-421 device. Means
I could program only one device (Using KitProg with PSoC Programmer
and PSoC Creator). So what could be the reason? See the attachment.
Actually it sounds very strange.
PSoC Programmer 1.jpg 221.8 K
Looking at PSoC Programmer screen capture, the setup looks good. And, 4014 is automatically recognized which indicates Kitprog acquired a path to 4014 over SWD. BTW, I noticed you're Flashing a 'debug' load. You can compile with debug mode switched to normal mode. This reduces FLASH image size (in case you need more FLASH space).
A few things to check.
- SWD wires are short length, <10cm long
- measure Vtarg on 4014 to see how close to 5V it is. Anything >4.5V works well.
- if too much capacitance on target pcb (approx. >47uF), the 74HC14 can't charge the capacitance fast enough for Kitprog timing constraints. Would need 74AC14 to charge large capacitance. Kitprog actually toggles XRES quite often during the programming sequence.
- for 74xx14 device, you can add a 0.1uF and 10uF-100uF capacitor across pin 14 and pin 7. This will help give it more switching current when XRES is toggled.
- is it possible you have previously programmed this part with FLASH protection turned on? If protection level was set to 'kill' mode, then this 4014 can't be re-programmed.
- is the second 4014 installed on pcb similar to first 4014?
- Many people forget to add 0.1uF capacitor to Vccd pin. Is it installed?
- Many people connect by mistake, Vccd to Vdd. This is wrong. Follow the datasheet for powering.
- Have you tried to program second 4014 using PSoc5LP of AN84858? What was result?
- try closing PSoC Programmer and re-opening it. (I suspect you've already tried this a few times.)
Let me know what you discover.
Go through below answers.
Answer 1. SWD wires were almost 15cm long. So I have also tried
using Male Female headers. (Connected KitProg with Logic Circuit
and then to Target Board using Male Female Headers) But it was not working.
Answer 2. I measured the voltage Vtarg. It was 4.72V.
Answer 3. My target board have three capacitor between VDD and
GND of 4014 (Pin7 and Pin8) 10uF/25V Tantalum Capacitor SMD,
1uF Ceramic Capacitor SMD and 100nF Ceramic Capacitor SMD.
Answer 4. For 74xx14 IC, I added 100nF Ceramic Capacitor and
10uF/50V Electrolytic Capacitor across Pin14 and Pin7. And then
I tried to program 4014. But it was not working.
Answer 5. I always keep Flash Protection - Unprotected. I have
never kept protection level in 'Kill' Mode. I was able to program
4014 many times by MiniProg3.
Answer 6. My all target PCBs are same. Actually they are mass
Answer 7. Yes. I have connected 0.1uF Ceramic Capacitor to
Vccd Pin. (Between Pin6 and Pin8)
Answer 8. No I haven't connected Vccd to Vdd.
Answer 9. Yes I have tried programming second 4014 using PSoC5LP
using AN84858. It was working. Actually I have programmed almost
50+ target board using AN84858.
Answer 10. I have already tried closing PSoC Programmer and re-opening
Tell me any new suggestions.
Thanks for the measurement details. I don't see any issues with your hardware design. There's still something we're missing. And yes, 15cm SWD wires is too long length.
Can you measure voltage on Vccd when powered with 74HC14. It should be close to 1.8V.
Can you replace 74HC14 with another 74HC14. I wonder if original 74HC14 is damaged. BTW, you can also use 74HC00 (different pinout).
You could try removing the 10uF tantalum capacitor from 4014 pin 7 (Vdd). It shouldn't make a difference, but worth testing.
Something is corrupting communication across SWD signals from Kitprog to target 4014. Check there are no solder shorts at Kitprog solder holes for SWD signals.
If you have access to oscilloscope, can you inspect Kitprog SWD signals that they are toggling 0-to-5V without strange distortion. Maybe compare with Miniprog3 SWD signals. You won't need to know the SWD protocol, just observe if the signals toggle like typical logic-level signals (nice and square).
I wonder which version of Kitprog you are using. Maybe newer Kitprog2/3 behaves differently from original Kitprog.
The original Kitprog from KIT-059?
Verify XRES pull-up resistor is connected between Kitprog XRES and Kitprog Vtarg (and not the output side of 74HC14).
Verify diode D1 is installed on bottom of Kitprog.
Maybe paste a photo of Kitprog/74HC14/target into this thread.
I'm running out of idea's. I hope something here helps.