Programmer options

Discuss the Integrated Development Environment (IDE)

Moderators: David Barker, Jerry Messina

Post Reply
SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Programmer options

Post by SHughes_Fusion » Mon Nov 02, 2015 9:40 am

While I've never used it, I note that Swordfish has the option to program your code directly after compilation.

Is there any way to add the PICKit3 to the list of programmers? It doesn't show as an option by default.

Also, how do you go about adding new programmers? I've developed my own bootloader and I was wondering how I go about using it within Swordfish - if it is possible. There are three variants. The Bluetooth one has two variants, one for 'production' apps where the bootloader needs to send a command to put the unit in to bootloader mode, and one for development where it just needs to toogle RTS low to put it in bootloader mode. Similarly, I have a USB development board which uses the FT230X. This also needs RTS toggling low. In both cases this is a bit of a compromise as RTS is the only output control line available - I believe DTR is a more commonly used line where available.

At the moment I use Coolterm to just dump the .hex file over the COM port but if I could integrate this in to Swordfish it would be ideal.

Jerry Messina
Swordfish Developer
Posts: 1245
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Programmer options

Post by Jerry Messina » Mon Nov 02, 2015 11:15 am

To install the Pickit3 as a programmer you need to have the PK3CMD.EXE command-line utility from MPLAB

From the SF IDE 'View' | 'Compile and Program Options...' select 'Programmer' tab
- select 'Install new programmer'
- select 'Create custom programmer entry' and 'Next'
- add display name: Pickit3 and 'Next'
- programmer filename: PK3CMD.EXE and 'Next'
- for path either let it search, or select 'Find manually' and navigate to the path for PK3CMD.EXE
(ie C:\Program Files(x86)\Microchip\MPLAB IDE\Programmer Utilities\PICkit3)
- Next
- parameters: -P$target-device$ -F$hex-filename$ -E -M -B
- select 'finished'

To power the PIC directly from pickit3 you can add the '-V' supply voltage parameter.
For 5.0 Volt:
-P$target-device$ -F$hex-filename$ -V5 -E -M -B

For 3.3V:
-P$target-device$ -F$hex-filename$ -V3.3 -E -M -B

The '-B' batch mode setting will keep the cmd window open until you manually close it.
If you want the window to close automatically, you could replace -B with the -Y verify option (to give you a chance to see the result of programming)

Under the 'Compile and Program Options | Programmer' tab make sure that the Default Programmer is set for your new Pickit3 entry.
Here's the available parameters for pk3cmd:

Code: Select all

----------------------------------------------------------------------------
10. Command Line Options
----------------------------------------------------------------------------
The following commands are available in the command line interface.

 Description			Options
----------------------------------------------------------------------------
B		     Batch Mode Operation 
C		     Blank Check Device 
E		     Erase Flash Device 
PKOB		     To connect PKOB 
F<file>              Hex File Selection 
G<region><Type><path> Read functions                           
                         region:
                         E = EEPROM
                         I = ID memory
                         C = Configuration memory
                         B = Boot Flash Memory
                         If no region is entered, the entire
                         device will be read.

                         Type F: = read into hex file, 
			 Path = full file path,
H		     Hold In Reset
L		     Release from Reset
I		     Use High Voltage MCLR
M<region>            Program Device
                         region:
                         P = Program memory
                         E = EEPROM
                         I = ID memory
                         C = Configuration memory
                         B = Boot Flash Memory
                         If no region is entered, the entire
                         device will be programmed.
N####,####	     Program Memory Range
                         #### is a hexidecimal number representing
                         Start and End Address in sequence
P<part>              Part Selection. Example: 18F67J50
R<file>              Reporgram          
S<file>		     SQTP File Selection
U##                  Program calibration memory,where:
			## is a hexidecimal number representing
			the least significant byte of the
			calibration value to be programmed
V<Voltage>	     Power Target from PICkit3
Y		     Verify Device
			 against selected HEX File 
?		     Help Screen                              
?E		     Displays Exit Code                       

     Example:   PK3CMD  /P18F67J50 /GFc:\HexCode.hex 
                               or
     Example:   PK3CMD  -P18F67J50 -GFc:\HexCode.hex 

Note: Commands are not case sensitive. Escape character can be a ‘-‘ or  ‘/’.  

Post Reply