Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
October 18, 2021, 09:17:57 09:17


Login with username, password and session length


Pages: [1]
Print
Author Topic: USB MSD Bootloader for PIC  (Read 586 times)
0 Members and 1 Guest are viewing this topic.
Johnny
Inactive

Offline Offline

Posts: 3

Thank You
-Given: 2
-Receive: 8


« on: May 03, 2021, 07:04:51 07:04 »

Made a bootloader a few years back that makes your PIC16/PIC18 appear as a mass storage device (flash drive) when plugged into your computer. You can program it by dragging and dropping an intel hex file into the drive or get MPLAB X to automatically transfer to the directory when you press build. Because the bootloader makes use of the USB Mass Storage Class, no software is needed to use the bootloader and it's really fast to upload firmware (feels instant).

Has some other cool features such as viewing your flash memory through a binary file called PROG_MEM.BIN that appears on the drive when user firmware is present. You can also erase the firmware by deleting this file. If your PIC has EEPROM, you can view/modify via an EEPROM.BIN file that will appear on the drive. You can modify your EEPROM by changing values in a hex editor and saving the file, or erase all EEPROM by deleting the file. Some good hex editors are HxD (for Windows), Hex Fiend (for Mac), or Bless Hex Editor (for Linux).

To get into "bootloader mode" you can either insert the USB cable into your computer with the bootloader button held down or reset the PIC whilst the boot button is held. The button can also be used to exit "bootloader mode". A neat trick you can do is get your firmware to detect when the bootloader button is pressed and reset the device. This will start the bootloader because your finger is already on the button when the device resets. So you can toggle between the bootloader and your firmware with the press of a button.

It's fully customisable, but includes hardware profiles for common development boards... Profiles and customisations are done in the config.h (or config.inc) file, you can choose your bootloader button pin, if you want to use an internal pull-up, active low button, use an LED to indicate you're in the bootloader, crystal options, etc. It's a good idea if you place the button on the MCLRE pin (when MCLRE is disabled of coarse), so you will not lose any useful pins.


There are two versions being developed. One written in C and another version in assembly. The C version requires a PRO license to compile. Currently there is only an assembly version for PIC16F145X. Will port that for PIC18 devices soon.

C version currently supports:
PIC16F1454
PIC16F1455
PIC16F1459
PIC18F14K50
PIC18F24K50
PIC18F25K50
PIC18F45K50
PIC18F26J53
PIC18F46J53
PIC18F27J53
PIC18F47J53

The project code can be found here: https://github.com/johnnydrazzi/USB-uC
Instructions on how to use the bootloader are on the hackaday page: https://hackaday.io/project/63204-usb-c-usb-pic-bootloader

Hopefully this is useful to some people.

Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC