|A Bootloader For Amicus & Swordfish
||An Open Source Alternative For Any Hardware Platform
One of the features of the Amicus system is the ability to program the microcontroller using a bootloader. The Amicus bootloader is freely available from Crown Hill (the makers of Amicus) but in order to simplify use for non-experienced programmers, it's tied to the hardware on the Amicus platform. Workarounds can be done but they are difficult.
The ds30 Loader is an extremely powerful and flexible Open Source bootloader that supports many PIC microcontrollers including the 18F25K20 used by Amicus. With a few adjustments, it's a great tool to use with the Amicus Compiler and Swordfish that ties in nicely to the TAP-28 application board. A big thanks to Graham at Digital-DYI for figuring out the details!
The dsLoader code is generated using MPLAB. The code must be configured for the microcontroller, clock frequency and configuration fuse options. I've included the necessary MPLAB files below (thanks to Graham), but more importantly, I've included a number of bootloader files for various combinations on the 18F25K20.
To use the bootloader with the TAP-28, a USB-UART adapter is needed. For use the the Amicus and the 18F25K20, an adapter supplying 3.3 volts is needed. The two adapters shown here will work, although the cable-type adapter will need to be snapped apart, and a wire moved from the 5v pad to the 3.3v pad.
To determine which com port is assigned to the adapter, plug it into a USB port on the computer. Active Device Manager and look under the Ports section to see which com port is assigned. Note that drivers may need to be installed the first time an adapter is connected.
Installing The Bootloader
The installation process is the same for both Amicus and Swordfish.
1. Install the ds30 Loader software on the PC.
2. Click on VIEW on the IDE and click on Programmer Options (Amicus) or Compile and Program Options (Swordfish).
3. Click on Install New Programmer on the Options Screen.
4. Click the radio button Create a Custom Programmer Entry and click Next.
5. Enter ds30 Loader in the Display Name box. Click Next.
6. Enter "ds30LoaderConsole.exe" (without the quotes) in the Programmer File Name box. Click Next.
7. Click Find Automatically. The program will take a short time to locate the ds30 Loader program. Click Next when the search is complete.
8. Enter the following line in the Parameters box. Change the com port number to the com port assigned to the USB-UART adapter*:
--file=$hex-filename$ --device=PIC$target-device$ --port=COM21 --baudrate=115200 --write-program --non-interactive
*Note: If the USB-UART adapter is plugged into a different USB port, the com port number will probably change.
9. Click Finished to complete the installation. Close the options window.
Installing The Bootloader File on the Microcontroller
Before the bootloader can be used, a small hex file must be installed on the microcontroller. This file is customized for each microcontroller, including clock speed, oscillator configuration and other configuration fuses. ds30 Loader provides a means to generate these loader files. To make using the loader easier, files for popular configurations are available below.
A PIC programmer is required to load the bootloader code. This need be done only once, then programs can be loaded using just the bootloader. Recomended programmers.
Using The Bootloader
If using Amicus, hit Compile and Program on the menu bar. In Swordfish, click Project in the menu bar and then click Compile and Program.
Several dialog boxes will flash by as the code compiles. When this is complete, a command-line window with a black background will open on the screen. Press the RESET switch on the TAP-28 and the code will be loaded.
ds30 Loader Hex Files
Loader files for common configurations of the 18F25K20 are listed below. Select the correct crystal frequency and whether you want the 4xPLL enabled. If it is enabled, the effective clock speed is four times the crystal speed. Be sure to specify this in your code.
Amicus: Declare Xtal 80
Swordfish: Clock = 80
ds30 Loader Files for 18F25K20
ds30 Loader MCP File for 18F25K20
If none of the above files matches your needs, new files can be generated easily using MPLAB. The ds30 Loader installation includes generic build files that must be customized for each microcontroller. See the ds30 Loader firmware documentation for details.
Thanks to Graham at Digital-DIY, I've posted the required MCP files customized for the 18F25K20 below. Open the project in MPLAB, change required parameters in the Settings file, and generate a customized loader file. The changes made to the generic 18F build file are discussed here.
ds30 Loader 18F25K20 Build Files