PDA

View Full Version : How to use the Microchip XPRESS drag and drop bootloader with MCSP



HenrikOlsson
- 27th December 2017, 18:03
The previous version of the MikroE PIC Clicker 2 for 18F67K40 had the standard FTDI USB to serial IC and the 67K40 came pre-programmed with a serial bootloader so you can use bootloader application provided by MikroE to program it.

A short while ago they released an updated version of this board which, instead of the FTDI chip, comes with a PIC16F1454 acting as the USB to serial chip. The main CPU still comes with the serial bootloader pre-programmed so you can use the serial bootloader if you wish. No need to worry about CONFIG bits since that's part of the bootloader, just DEFINE OSC 64 and away you go.

But the cool thing is that when you plug this new board in to the PC it not only shows up as a serial port, it also shows up as a mass storage device. Here you can see it showing up as D: with a label XPRESS on my system (I appologize for the Swedish screenshot but you get the idea).


8546


All you need to do to program the 18F67K40 is to drag and drop your .hex file onto this device - done - and it's fast.

We can tell MicroCodeStudio to automatically copy the file onto the device after successful compilation. To do this we need to go to View->Compile and Program Options and Add New Programmer. I labeled mine XPRESS Drag & Drop Bootloader but you can obviously call it anything you want. Since we want to do a basic file copy the Programmer Filename will be xcopy.exe and this is usually located in c:\windows\system32 but just click Find Automatically and MCSP will find it for you.

Next is the parameters we need to pass to xcopy. I used /Y $long-hex-filename$ D:\ where the /Y tells xcopy not to ask us if we want to overwrite an existing file with the same name, the $long-hex-filename$ is the MCSP variable for the path and filename of our .hex file and D:\ is the destination path. You obviously need to match the destination path to however your system is configured, it only happened to be D:\ on my system.

WARNINGS:
Once you drag/drop a file onto the device it will overwrite the bootloader that originally was on the 67K40. I don't know if a simple DEFINE LOADER_USED would have saved it but at this point I don't really care because this method is SO much faster than messing around with the serial bootloader. The USB to serial bridge will still work (the board still shows up as a serial port on the PC) but the bootloader is no longer there. If you want the bootloader back MikroE provides the .hex file for it so you can use any device programmer to get it back into the 67K40.

If you're using detachable harddrives and USB sticks (who doesn't) it's possible that the next time you plug the Clicker 2 into the PC it shows up as another drive letter which obviously makes MCSP tell xcopy to copy the .hex file to the wrong destination. Likely not the end of the World but might be slightly confusing until figured out.

/Henrik.

Ioannis
- 28th December 2017, 13:43
Very nice Henrik, thanks for sharing! (Though I could not find that board...)

Ioannis

HenrikOlsson
- 28th December 2017, 16:10
Here it is: https://www.mikroe.com/clicker-2-pic18fk
Digikey is carrying MikroE's products but they don't seem to have this one yet. It's also unfortunate that they named it the same as the old one so if you find it at a distributor you have to ask which revision of the board it is if you want the one acting as a composite device.

/Henrik.