PICkit 2 & Flowcode 3 programming - return code 24
PICkit 2 & Flowcode 3 programming - return code 24
Hello,
Hope you can assist, my problem seems to have been almost covered before in this forum & concerns the use of pk2cmd_mtx.exe which was discussed in 2007.
I bought PICkit 2 Debug Express & got it working quickly with MPlab, so I'm OK with that then I got Flowcode 3 with EPE mag subscription, & I'm trying to program the 16F887 chip on the PICkit with it. I've followed all the advice I can find in this forum, e.g. spent hours working thro' the short file name issue. I downloaded the zip file containg the pk2cmd_mtx.exe and stored it as instructed, changing the complier options to the same location. Now I'm stuck however on the programming stage with return code 24. Below is my complier options settings for the programmer & then the output from the compiler when I run compile to chip.
Thanks in advance
Programmer location:
C:\Program Files\pk2cmd_mtx\pk2cmd_mtx.exe
Parameters
-PPIC%p -F%F.hex -M -A5 -H -BC:\program files\pk2cmd_mtx
Compiler messages:
File name: C:\Program Files\Microchip\PICkit 2 v2\DBE Demo\Flowcode3.c
Generated by: Flowcode v3.6.11.53
Date: Wednesday, October 21, 2009 16:11:26
Licence: Student
Registered to: Steve xxxxx
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F887 "Flowcode3.c"
BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday
Licensed to FlowCode User under Single user Standard License for 1 node(s)
Limitations: PIC12,PIC16 max code size:4096 words, max RAM banks:Unlimited, Non commercial use only
Flowcode3.c
Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\pp.exe" "C:\Program Files\Microchip\PICkit 2 v2\DBE Demo\Flowcode3.c" -i "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\include" -d _PIC16F887 -la -c2 -o Flowcode3.pp -v -d _BOOSTC -d _PIC16
Flowcode3.c success
success
......
Return code = 0
Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\boostlink.pic.exe -ld "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\lib" libc.pic16.lib flowcode.pic16.lib "Flowcode3.obj" -t PIC16F887 -d "C:\Program Files\Microchip\PICkit 2 v2\DBE Demo" -p "Flowcode3"
BoostLink Optimizing Linker Version 6.70
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday
Building CASM file
Memory Usage Report
===================
RAM available:368 bytes, used:5 bytes (1.4%), free:363 bytes (98.6%),
Heap size:363 bytes, Heap max single alloc:110 bytes
ROM available:8192 words, used:45 words (0.6%), free:8147 words (99.4%)
success
Return code = 0
Launching the programmer...
C:\Program Files\pk2cmd_mtx\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode3.hex -M -A5 -H -BC:\program files\pk2cmd_mtx
PK2DeviceFile.dat device file requires an update of pk2cmd
Return code = 24
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
Hope you can assist, my problem seems to have been almost covered before in this forum & concerns the use of pk2cmd_mtx.exe which was discussed in 2007.
I bought PICkit 2 Debug Express & got it working quickly with MPlab, so I'm OK with that then I got Flowcode 3 with EPE mag subscription, & I'm trying to program the 16F887 chip on the PICkit with it. I've followed all the advice I can find in this forum, e.g. spent hours working thro' the short file name issue. I downloaded the zip file containg the pk2cmd_mtx.exe and stored it as instructed, changing the complier options to the same location. Now I'm stuck however on the programming stage with return code 24. Below is my complier options settings for the programmer & then the output from the compiler when I run compile to chip.
Thanks in advance
Programmer location:
C:\Program Files\pk2cmd_mtx\pk2cmd_mtx.exe
Parameters
-PPIC%p -F%F.hex -M -A5 -H -BC:\program files\pk2cmd_mtx
Compiler messages:
File name: C:\Program Files\Microchip\PICkit 2 v2\DBE Demo\Flowcode3.c
Generated by: Flowcode v3.6.11.53
Date: Wednesday, October 21, 2009 16:11:26
Licence: Student
Registered to: Steve xxxxx
NOT FOR COMMERCIAL USE
http://www.matrixmultimedia.com
Launching the compiler...
C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\boostc.pic16.flowcode.exe -v -t PIC16F887 "Flowcode3.c"
BoostC Optimizing C Compiler Version 6.70 (for PIC16 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday
Licensed to FlowCode User under Single user Standard License for 1 node(s)
Limitations: PIC12,PIC16 max code size:4096 words, max RAM banks:Unlimited, Non commercial use only
Flowcode3.c
Starting preprocessor: "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\pp.exe" "C:\Program Files\Microchip\PICkit 2 v2\DBE Demo\Flowcode3.c" -i "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\include" -d _PIC16F887 -la -c2 -o Flowcode3.pp -v -d _BOOSTC -d _PIC16
Flowcode3.c success
success
......
Return code = 0
Launching the linker/assembler...
C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\boostlink.pic.exe -ld "C:\Program Files\Matrix Multimedia\Flowcode V3\BoostC\lib" libc.pic16.lib flowcode.pic16.lib "Flowcode3.obj" -t PIC16F887 -d "C:\Program Files\Microchip\PICkit 2 v2\DBE Demo" -p "Flowcode3"
BoostLink Optimizing Linker Version 6.70
http://www.sourceboost.com
Copyright(C) 2004-2007 Pavel Baranov
Copyright(C) 2004-2007 David Hobday
Building CASM file
Memory Usage Report
===================
RAM available:368 bytes, used:5 bytes (1.4%), free:363 bytes (98.6%),
Heap size:363 bytes, Heap max single alloc:110 bytes
ROM available:8192 words, used:45 words (0.6%), free:8147 words (99.4%)
success
Return code = 0
Launching the programmer...
C:\Program Files\pk2cmd_mtx\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode3.hex -M -A5 -H -BC:\program files\pk2cmd_mtx
PK2DeviceFile.dat device file requires an update of pk2cmd
Return code = 24
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello
You should be able to use the version of the tool that comes as part of Flowcode v3.6. If you are not running version 3.6 then you can download it from here.
http://www.matrixmultimedia.com/support ... .php?t=541
The paths to the programming tool then becomes.
Programmer location:
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe
Parameters
-PPIC%p -F%F.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
Let me know how you get on.
You should be able to use the version of the tool that comes as part of Flowcode v3.6. If you are not running version 3.6 then you can download it from here.
http://www.matrixmultimedia.com/support ... .php?t=541
The paths to the programming tool then becomes.
Programmer location:
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe
Parameters
-PPIC%p -F%F.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
Let me know how you get on.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PICkit 2 & Flowcode 3 programming - return code 24
Thanks Benj,
Done that, was already on FC Ver 3.6.11.53 so just changed the compiler settings. I've got the "use external program --) box unticked as I saw in an earlier post, is that something else I need to look at?
Anyway still no joy now getting as follows BUT a second try got me as at bottom:
FIRST RUN
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode4.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
\ \ \ \ PICkit 2 Program Report
21-Oct-2009, 16:38:06
Device Type: PIC16F887
Program Memory Errors
Address Good Bad
000000 002818 00008D
Return code = 34
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
SECOND RUN
Launching the programmer...
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode4.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
PICkit 2 found with Operating System v0.0.0
Use -D to download minimum required OS v2.10.0 or later
Return code = 11
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
Done that, was already on FC Ver 3.6.11.53 so just changed the compiler settings. I've got the "use external program --) box unticked as I saw in an earlier post, is that something else I need to look at?
Anyway still no joy now getting as follows BUT a second try got me as at bottom:
FIRST RUN
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode4.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
\ \ \ \ PICkit 2 Program Report
21-Oct-2009, 16:38:06
Device Type: PIC16F887
Program Memory Errors
Address Good Bad
000000 002818 00008D
Return code = 34
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
SECOND RUN
Launching the programmer...
C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2\pk2cmd_mtx.exe -PPIC16F887 -FFlowcode4.hex -M -A5 -H -BC:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2
PICkit 2 found with Operating System v0.0.0
Use -D to download minimum required OS v2.10.0 or later
Return code = 11
Flowcode was unable to transfer the flowchart to the microcontroller. Check the programmer options and physical connections.
FINISHED
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello
You can update the firmware loaded onto your PICkit by opening the Microchip PICkit 2 Programmer tool. Then choosing the Tools menu and selecting download PICkit 2 Operating System. A compatible operating system hex file is available from the "C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2" directory.
This should allow your PICkit to program the device correctly.
Next close the PICkit software and ensure that the "Use external program to set configuration options" box is ticked in the Chip -> Compiler Options window in Flowcode.
Then below this here are the location and parameter settings.
Location: C:\Program Files\Matrix Multimedia\Common\PPPv3\PPPv3.exe
Params: -cs 2 -chip PIC%p -config
If your copy of Flowcode is not installed in the default directory then you will need to update the above paths appropriately.
Now when you click on chip -> configure you will be able to define the configuration setting for the chip before you compile and program.
You can update the firmware loaded onto your PICkit by opening the Microchip PICkit 2 Programmer tool. Then choosing the Tools menu and selecting download PICkit 2 Operating System. A compatible operating system hex file is available from the "C:\Program Files\Matrix Multimedia\Flowcode V3\tools\PICkit2" directory.
This should allow your PICkit to program the device correctly.
Next close the PICkit software and ensure that the "Use external program to set configuration options" box is ticked in the Chip -> Compiler Options window in Flowcode.
Then below this here are the location and parameter settings.
Location: C:\Program Files\Matrix Multimedia\Common\PPPv3\PPPv3.exe
Params: -cs 2 -chip PIC%p -config
If your copy of Flowcode is not installed in the default directory then you will need to update the above paths appropriately.
Now when you click on chip -> configure you will be able to define the configuration setting for the chip before you compile and program.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello again, thanks for above, programmer now runs OK! However chip doesn't seem to be getting program on board - I get the busy light on the PICkit OK (just trying to light up 1 led to start). Problem appears to be with config chip screen, I can select 16F887 from expert screen but can't auto detect chip, keeps saying USB not connected (it is), also on simple screen, can't select any PIC above a PIC 16F88. Each time I open this screen it comes up with a 16F84A so if I press OK, it says configuration is for a different microcontroller. In effect therefore I can't configure the chip! I've left clock frequency at 20MHz & set simulation speed to 10.
As I said before, I've had the PICkit working with MPlab so it's OK.
Thanks in advance,
Steve
As I said before, I've had the PICkit working with MPlab so it's OK.
Thanks in advance,
Steve
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello Steve
PPP can ONLY detect the chips on the EB006 and HP488 boards.
If you go into chip -> Configure and then choose the expert screen, then your device should already be selected in the list, then you will need to use the following settings.
HS - Clock speed 4MHz or over or XT - Clock speed under 4MHz
Watchdog Off
Low Voltage Programming Off
Code protection Off
Once you have assigned your settings click ok to store them into Flowcode.
Your program should then run correctly when you send the program.
PPP can ONLY detect the chips on the EB006 and HP488 boards.
If you go into chip -> Configure and then choose the expert screen, then your device should already be selected in the list, then you will need to use the following settings.
HS - Clock speed 4MHz or over or XT - Clock speed under 4MHz
Watchdog Off
Low Voltage Programming Off
Code protection Off
Once you have assigned your settings click ok to store them into Flowcode.
Your program should then run correctly when you send the program.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello Ben,
Thanks again for last reply, I've now got the chip to take the program but I still believe there's a configuration problem as the simple led light up program doesn't work. I've gone back to mplab from where a similar program works every time. I looked at the config word being used by mplab :
2007 20C4
2008 3EFF
So I then went back to Flowcode unticked PPPv3 and put this config in manually, but still to no avail. The full config from MPLAB is as follows:
Address Value Field Category Setting
2007 20C4OSC Oscillator Internal RC No Clock
WDT Watchdog Timer Off
PUT Power Up Timer On
MCLRE Master Clear Enable RE3 is digital input
CP Code Protect Off
CPD Data EE Read Protect Off
BODEN Brown Out Detect BOD and SBOREN disabled
IESO Internal External Switch Over ModeDisabled
FCMEN Monitor Clock Fail-safe Disabled
LVP Low Voltage Program Disabled
2008 3EFFBOR4V Brown Out Reset Sel Bit Brown out at 2.1V
WRT Self Write Enable No protection
As the above works from MPLAB but not using thr config word it produces, is there anything else I could try?
Thanks again
Steve
Thanks again for last reply, I've now got the chip to take the program but I still believe there's a configuration problem as the simple led light up program doesn't work. I've gone back to mplab from where a similar program works every time. I looked at the config word being used by mplab :
2007 20C4
2008 3EFF
So I then went back to Flowcode unticked PPPv3 and put this config in manually, but still to no avail. The full config from MPLAB is as follows:
Address Value Field Category Setting
2007 20C4OSC Oscillator Internal RC No Clock
WDT Watchdog Timer Off
PUT Power Up Timer On
MCLRE Master Clear Enable RE3 is digital input
CP Code Protect Off
CPD Data EE Read Protect Off
BODEN Brown Out Detect BOD and SBOREN disabled
IESO Internal External Switch Over ModeDisabled
FCMEN Monitor Clock Fail-safe Disabled
LVP Low Voltage Program Disabled
2008 3EFFBOR4V Brown Out Reset Sel Bit Brown out at 2.1V
WRT Self Write Enable No protection
As the above works from MPLAB but not using thr config word it produces, is there anything else I could try?
Thanks again
Steve
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hello Steve
Right ok if you go back into the compiler options and retick PPP to set the config settings.
The click ok and click Chip -> Configure.
In here click the Expert settings button.
Then in the expert screen you want to configure your device similar to the following.
Once you have done this then fingers crossed your device should program and run correctly.
You may have to check the View -> Project options window that the clock speed is defined correctly for the internal oscillator speed (4000000 by default). Also make sure that the ICD mode setting is unticked.
Right ok if you go back into the compiler options and retick PPP to set the config settings.
The click ok and click Chip -> Configure.
In here click the Expert settings button.
Then in the expert screen you want to configure your device similar to the following.
Once you have done this then fingers crossed your device should program and run correctly.
You may have to check the View -> Project options window that the clock speed is defined correctly for the internal oscillator speed (4000000 by default). Also make sure that the ICD mode setting is unticked.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hi Ben,
Got there at last!!! Sometimes pays not to look for a complicated answer when a simple one will suffice!! I could still not get my program working, but further comparisons with MPLab showed from the C output file that Port D was being addressed, which apparently is the port with the LED's used on the PICkit2. I had been outputting to Port A (as in the Flowcode example in the "Getting Started guide"). Easy when you know, but the problem was I had just assumed it would be the same!
Anyway thanks for all your help, I'm sure there'll be lots more question later
Steve
PS I couldn't find a view project window or reference to ICD mode, I'm guessing these are features introduced in V4?
Got there at last!!! Sometimes pays not to look for a complicated answer when a simple one will suffice!! I could still not get my program working, but further comparisons with MPLab showed from the C output file that Port D was being addressed, which apparently is the port with the LED's used on the PICkit2. I had been outputting to Port A (as in the Flowcode example in the "Getting Started guide"). Easy when you know, but the problem was I had just assumed it would be the same!
Anyway thanks for all your help, I'm sure there'll be lots more question later

Steve
PS I couldn't find a view project window or reference to ICD mode, I'm guessing these are features introduced in V4?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PICkit 2 & Flowcode 3 programming - return code 24
Hi Steve
Great glad your up and running now. Its always a bit of an uphill struggle when starting out.
Yes the Project options and ICD are parts of V4 so don't worry about these.
Great glad your up and running now. Its always a bit of an uphill struggle when starting out.
Yes the Project options and ICD are parts of V4 so don't worry about these.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel